|
OSMQ v2.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectosmq.clients.PublisherBase
osmq.clients.PublisherBean
A class used by client applications to write messages.
The PublisherBean dynamically locates and connects to a message broker. Once connected, the PublisherBean supports sending messages to a named recipient, or publishing anonymous topical messages that can be received by multiple subscribers.
Constructor Summary | |
PublisherBean()
|
|
PublisherBean(PubConnectionHandler handler)
|
|
PublisherBean(RemoteService si)
|
Method Summary | |
void |
close()
Closes the publisher's connection to the message broker. |
void |
commit()
Transmits all messages that were published since the last call to commit() or rollback() . |
java.lang.String |
getBrokerName()
Returns the name of the remote message broker for this session. |
java.lang.String |
getClientID()
Returns the client identifier used by this session to communicate with the message broker. |
long |
getCommitTransactionCount()
|
long |
getConnectionPublishedCount()
Returns the total number of messages that have been published by all MessagePublishers. |
ExceptionListener |
getExceptionListener()
Return the ExceptionListener that will be notified when there is an exception due to an inability to connect with the broker, or due to an I/O or communications failure. |
java.lang.String |
getHostName()
Returns the message broker's host address as a DNS host name or IP address. |
int |
getPortID()
Returns the port id that will be used to connect to the message broker. |
long |
getPublishedCount()
Returns the number of messages that have been published by this MessagePublisher. |
boolean |
isAutoCommit()
Returns true if the publisher is in auto-commit mode. |
boolean |
isOpen()
Returns true if the message publisher has not been closed. |
boolean |
isThreaded()
|
void |
onException(java.lang.Exception e)
Notify user of an exception. |
void |
open()
Locates and connects to the remote message broker, and performs the necessary publisher authentication. |
void |
publish(Message v)
Performs a logical write of a Message object to the message broker. |
void |
rollback()
Discards all messages that were published since the last call to commit() or rollback() . |
void |
setAutoCommit(boolean autocommit)
Turns on or off the autocommitment of published messages to the message broker. |
void |
setBrokerName(java.lang.String broker)
Defines the named message broker to use for message processing (sending and receiving). |
void |
setClientID(java.lang.String id)
Sets the identity of the application as a message originator (publisher) |
void |
setExceptionListener(ExceptionListener listener)
Sets an ExceptionListener that will be notified when there is an exception due to an inability to connect with the broker, or due to an I/O or communications failure. |
void |
setHostName(java.lang.String hostname)
Overrides the host name / IP address of the remote server; |
void |
setPortID(int port)
Overrides the port id of the remote server; |
void |
setThreaded(boolean threaded)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface osmq.clients.Publisher |
commit, getConnectionPublishedCount, getPublishedCount, isOpen, publish, rollback |
Constructor Detail |
public PublisherBean()
public PublisherBean(PubConnectionHandler handler)
public PublisherBean(RemoteService si)
Method Detail |
public void setThreaded(boolean threaded)
setThreaded
in interface Publisher
public boolean isThreaded()
isThreaded
in interface Publisher
public void onException(java.lang.Exception e)
ExceptionListener
onException
in interface ExceptionListener
public void open() throws java.io.IOException
Publisher
open
in interface Publisher
java.io.IOException
public void close()
close
in interface Publisher
public void setClientID(java.lang.String id)
setClientID
in interface Publisher
id
- a unique name identifying the client application
to the message broker.public java.lang.String getClientID()
getClientID
in interface Publisher
public void setBrokerName(java.lang.String broker)
setBrokerName
in interface Publisher
public java.lang.String getBrokerName()
getBrokerName
in interface Publisher
public void setPortID(int port)
NOTE: Normally this method should NOT be called by the client application.
setPortID
in interface Publisher
public int getPortID()
Publisher
getPortID
in interface Publisher
public void setHostName(java.lang.String hostname)
NOTE: Normally this method should NOT be called by the client application.
setHostName
in interface Publisher
public java.lang.String getHostName()
Publisher
getHostName
in interface Publisher
public void setExceptionListener(ExceptionListener listener)
setExceptionListener
in interface Publisher
public ExceptionListener getExceptionListener()
getExceptionListener
in interface Publisher
public void setAutoCommit(boolean autocommit) throws java.io.IOException
When autocommit is ON, each message that is published gets transmitted to the message broker for distribution.
When autocommit is OFF, the user must call commit()
to send published messages to the broker. Published messages that have not
been committed can be discarded by a call to the method rollback().
The commit() method transmits all messages that were published since the last call to commit() or rollback().
NOTE: The default mode is autocommit ON.
setAutoCommit
in interface Publisher
java.io.IOException
- an attempt to set autocommit to true when
there are messages that have been published but not commited
or rolled back.PublisherBase.commit()
,
PublisherBase.rollback()
public boolean isAutoCommit()
Publisher
isAutoCommit
in interface Publisher
public long getPublishedCount()
public long getConnectionPublishedCount()
public void rollback() throws java.io.IOException
Discards all messages that were published since the last
call to commit()
or rollback()
.
This method is available when autocommit mode is OFF.
java.io.IOException
- autocommit mode is ONPublisherBase.commit()
,
PublisherBase.setAutoCommit(boolean)
public void commit() throws java.io.IOException, MessageException
Transmits all messages that were published since the last
call to commit()
or rollback()
.
This method is available when autocommit mode is OFF.
java.io.IOException
- autocommit mode is ON
MessageException
PublisherBase.rollback()
,
PublisherBase.setAutoCommit(boolean)
public long getCommitTransactionCount()
public void publish(Message v) throws java.io.IOException, MessageException
The physical write to the broker may not coincide with the logical write, depending on whether autocommit has been enabled.
java.io.IOException
- if MessagePublisher has been closed or
message coult not be written to the broker.
MessageException
PublisherBase.isAutoCommit()
,
PublisherBase.commit()
,
PublisherBase.rollback()
public boolean isOpen()
PublisherBase.close()
|
(c) 2000 - 2003 MQue Systems All Rights Reserved |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |