|
OSMQ v2.0.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface used by client applications to receive messages. The Subscriber supports subscribing to one or more topics. When the subscriber is opened, the broker is located (normally dynamically) and messages begin flowing to the MessageListener that was registerd by the application. Messages flowing the message listener include those with topics that match the registered subscriptions, as well as messages addressed specifically to the subscriber.
Method Summary | |
void |
addTopic(java.lang.String topic)
Registers a topic for this subscriber. |
void |
close()
Closes the message queues and halts message flow to the subscriber. |
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. |
SubscriberCountManager |
getConnectionCount()
Returns the number of messages received by all subscriber threads in this application. |
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. |
MessageListener |
getMessageListener()
Returns a reference to the MessageListener object that currently receives all topical and point-to-point messages for this client. |
int |
getPortID()
Returns the port ID that will be used to connect to the message broker. |
SubscriberCountManager |
getSessionCount()
Returns the number of messages received by this Subscriber instance. |
int |
getThreadPriority()
Returns the thread priority that will be used by the message subscriber thread. |
boolean |
isOpen()
Returns true if there is a connection to the message broker and subcription message are being accepted. |
boolean |
isPersistentTopics()
Returns true if the session is using persistent topics. |
void |
open()
Locates and connects to the remote message broker. |
void |
removeTopic(java.lang.String topic)
Terminates receiving messages for a specific topic. |
void |
setBrokerName(java.lang.String broker)
Defines the named message broker that should be used for message processing (subscription and receiving message). |
void |
setClientID(java.lang.String id)
Sets the identity of the application as a message recipient/subscriber |
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 |
setMessageListener(MessageListener defaultlistener)
Defines the MessageListener object that will receive all the topical and point-to-point messages for this client. |
void |
setPersistentTopics(boolean pt)
Defines whether the session will employ persistent topics. |
void |
setPortID(int port)
Sets the port ID that the remote message server uses for connections. |
void |
setThreadPriority(int priority)
Sets the thread priority for the subscriber notification thread. |
Method Detail |
public void setClientID(java.lang.String id)
setClientID
in interface ClientAdapter
id
- a unique name identifying the client application
to the message broker.public java.lang.String getClientID()
getClientID
in interface ClientAdapter
public void setPortID(int port)
NOTE: Normally this method should NOT be called by the client application.
setPortID
in interface ClientAdapter
public int getPortID()
getPortID
in interface ClientAdapter
setPortID(int)
public void setHostName(java.lang.String hostname)
NOTE: Normally this method should NOT be called by the client application.
setHostName
in interface ClientAdapter
public java.lang.String getHostName()
getHostName
in interface ClientAdapter
setHostName(String)
public void setBrokerName(java.lang.String broker)
setBrokerName
in interface ClientAdapter
public java.lang.String getBrokerName()
getBrokerName
in interface ClientAdapter
public void setMessageListener(MessageListener defaultlistener)
public MessageListener getMessageListener()
setMessageListener(MessageListener)
public void addTopic(java.lang.String topic) throws java.io.IOException
java.io.IOException
setMessageListener(MessageListener)
,
open()
public void removeTopic(java.lang.String topic) throws java.io.IOException
java.io.IOException
public void setThreadPriority(int priority)
public int getThreadPriority()
java.lang.ArrayIndexOutOfBoundsException
- if p is not a valid element position.public void open() throws java.io.IOException
If the application has registered as a message listener (by calling the setMessageListener method), messages will begin flowing to that listener. Additionally, any message that is addressed specifically to this agent (Client ID) will be passed to the registered message listener.
To terminate the connection to the message broker and halt message flow, the application makes a call the close() method.
open
in interface ClientAdapter
java.io.IOException
setMessageListener(MessageListener)
,
close()
public boolean isOpen()
isOpen
in interface ClientAdapter
public void close()
close
in interface ClientAdapter
public SubscriberCountManager getConnectionCount()
public SubscriberCountManager getSessionCount()
public void setPersistentTopics(boolean pt)
public boolean isPersistentTopics()
public void setExceptionListener(ExceptionListener listener)
setExceptionListener
in interface ClientAdapter
public ExceptionListener getExceptionListener()
getExceptionListener
in interface ClientAdapter
|
(c) 2000 - 2003 MQue Systems All Rights Reserved |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |