|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--org.openeai.OpenEaiObject
|
+--org.openeai.jms.consumer.MessageConsumer
|
+--org.openeai.jms.consumer.PubSubConsumer
This consumer consumes messages from a JMS Topic. Then based on the content of the message it executes 'SyncCommands' associated to the consumer and the message consumed as specified in it's configuration document (deployment descriptor).
The actual business logic related to the message consumed is performed by the Sync command implementations.
| Nested Class Summary | |
protected class |
PubSubConsumer.ConsumerShutdownHook
This Thread will be started when the consumer receives a shutdown signal from the os. |
protected class |
PubSubConsumer.MonitorConsumer
This Thread will sleep for a specified period of time and then wake up and check the status of the consumer by attempting to create/delete a TemporaryTopic. |
protected class |
PubSubConsumer.MyTopicListener
This is the JMS MessageListener implementation for OpenEAI PubSubConsumers. |
| Nested classes inherited from class org.openeai.jms.consumer.MessageConsumer |
MessageConsumer.MessageTransaction |
| Field Summary |
| Fields inherited from class org.openeai.jms.consumer.MessageConsumer |
CONNECTED, DISCONNECTED, INITIALIZED, m_commandConfigs, m_inProcessMessages, m_messages, m_numThreads, m_password, m_startOnInitialization, m_threadPool, m_userName, NOT_INITIALIZED, STARTED, STOPPED |
| Fields inherited from class org.openeai.OpenEaiObject |
logger |
| Constructor Summary | |
PubSubConsumer()
|
|
PubSubConsumer(ConsumerConfig cConfig)
As AppConfig reads through a gateway's deployment document, it will build a ConsumerConfig Java object and pass that object to this constructor. |
|
PubSubConsumer(java.lang.String cfName,
java.lang.String tName)
|
|
| Method Summary | |
PubSubMessageBalancer |
getBalancer()
Returns the PubSubMessageBalancer associated to this Consumer. |
javax.jms.Topic |
getTopic()
Returns the Consumer's Topic object. |
javax.jms.TopicConnection |
getTopicConnection()
Returns the Consumer's TopicConnection object. |
javax.jms.TopicConnectionFactory |
getTopicConnectionFactory()
Returns the Consumer's TopicConnectionFactory object. |
javax.jms.TopicSession |
getTopicSession()
Returns the Consumer's TopicSession object. |
javax.jms.TopicSubscriber |
getTopicSubscriber()
Returns the Consumer's TopicSubscriber object. |
protected void |
init(java.util.Properties props)
Invokes MessageConsumer.init(Properties) and adds the ConsumerShutDownHook for this consumer. |
void |
setBalancer(PubSubMessageBalancer balancer)
Sets the PubSubMessageBalancer associated to this Consumer. |
void |
setTopic(javax.jms.Topic topic)
Sets the Consumer's Topic object. |
void |
setTopicConnection(javax.jms.TopicConnection topicConnection)
Sets the Consumer's TopicConnection object. |
void |
setTopicConnectionFactory(javax.jms.TopicConnectionFactory tcf)
Sets the Consumer's TopicConnectionFactory object. |
void |
setTopicSession(javax.jms.TopicSession session)
Sets the Consumer's TopicSession object. |
void |
setTopicSubscriber(javax.jms.TopicSubscriber topicSubscriber)
Sets the Consumer's TopicSubscriber object. |
void |
startConsumer()
Starts the consumer making it ready to consume messages from the Topic that it connects to. |
void |
startMonitor()
This method starts the Consumer's "Monitor Thread". |
void |
stopConsumer()
Attempts to cleanly shutdown the Consumer. |
void |
stopMonitor()
This method stops the Consumer's "Monitor Thread" so it won't attempt to restart the consumer. |
| Methods inherited from class org.openeai.OpenEaiObject |
addLog4jProperty, getAppName, getDebug, getFromAddr, getLog4jProperties, getMailHost, getMailService, getProperties, getToAddr, initializeLog4j, initializeLog4j, initializeLog4j, setAppName, setDebug, setFromAddr, setMailHost, setMailService, setProperties, setToAddr |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public PubSubConsumer()
public PubSubConsumer(java.lang.String cfName,
java.lang.String tName)
public PubSubConsumer(ConsumerConfig cConfig)
throws javax.jms.JMSException,
javax.naming.NamingException,
java.io.IOException
ConsumerConfig| Method Detail |
public void stopMonitor()
When the consumer is started it starts a Thread that monitors the Consumer's connection to the broker. If that connection is broken for some reason, that "Monitor Thread" will attempt to restart the consumer. This continues indefinitely until the consumer is able to re-connect to the broker.
This method allows an application to in effect stop that monitor thread so they can shut the consumer down without it restarting itself.
public void startMonitor()
public final PubSubMessageBalancer getBalancer()
PubSubMessageBalancerpublic final void setBalancer(PubSubMessageBalancer balancer)
PubSubMessageBalancerpublic final javax.jms.TopicConnectionFactory getTopicConnectionFactory()
See the JMS Specification to learn more about JMS objects.
public final void setTopicConnectionFactory(javax.jms.TopicConnectionFactory tcf)
See the JMS Specification to learn more about JMS objects.
public final javax.jms.Topic getTopic()
See the JMS Specification to learn more about JMS objects.
public final void setTopic(javax.jms.Topic topic)
See the JMS Specification to learn more about JMS objects.
public final javax.jms.TopicConnection getTopicConnection()
See the JMS Specification to learn more about JMS objects.
public final void setTopicConnection(javax.jms.TopicConnection topicConnection)
See the JMS Specification to learn more about JMS objects.
public final javax.jms.TopicSession getTopicSession()
See the JMS Specification to learn more about JMS objects.
public final void setTopicSession(javax.jms.TopicSession session)
See the JMS Specification to learn more about JMS objects.
public final javax.jms.TopicSubscriber getTopicSubscriber()
See the JMS Specification to learn more about JMS objects.
public final void setTopicSubscriber(javax.jms.TopicSubscriber topicSubscriber)
See the JMS Specification to learn more about JMS objects.
public final void startConsumer()
throws javax.naming.NamingException,
javax.jms.JMSException
Additionally, this method starts the Consumer's Monitor that will monitor and attempt to resolve any broker connection issues encountered for the life of the Consumer.
javax.jms.JMSException
javax.naming.NamingExceptionPointToPointConsumer.startConsumer(),
PubSubConsumer.MonitorConsumerpublic final void stopConsumer()
NOTE: This method DOES NOT unsubscribe from durable subscriptions. This way, when the gateway is brought back up, its consumers will have any missed messages available for consumption. Durable subscriptions must be cleaned up manually if that is desired.
stopConsumer in class MessageConsumerPubSubConsumer.MonitorConsumer,
PubSubConsumer.ConsumerShutdownHook
protected void init(java.util.Properties props)
throws java.io.IOException
init in class MessageConsumerjava.io.IOExceptionMessageConsumer.init(Properties)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||