|
|||||||||||
| 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.PointToPointConsumer
This consumer consumes messages from a JMS Queue. Then based on the content of the message it executes commands associated to the consumer and the message consumed as specified in it's configuration document (deployment descriptor).
If the JMSReplyTo property of the consumed message contains data (i.e. - the Queue to which replies should be sent), it will execute a 'RequestCommand' and return it's response to the calling application. Otherwise, it will execute a 'SyncCommand'.
The actual business logic related to the message consumed is performed by the Request/Sync command implementations.
| Nested Class Summary | |
protected class |
PointToPointConsumer.ConsumerShutdownHook
This Thread will be started when the consumer receives a shutdown signal from the os. |
protected class |
PointToPointConsumer.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 TemporaryQueue. |
protected class |
PointToPointConsumer.MyQueueListener
This is the JMS MessageListener implementation for OpenEAI PointToPointConsumers. |
protected class |
PointToPointConsumer.RequestTransaction
This is the class that is used to execute the RequestCommand associated to a message consumed by the Consumer. |
| 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 | |
PointToPointConsumer()
|
|
PointToPointConsumer(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. |
|
PointToPointConsumer(java.lang.String cFactory,
java.lang.String qName)
|
|
| Method Summary | |
void |
addRequestCommand(java.lang.String requestName,
java.lang.String className)
Adds an initialized RequestCommand object to the list of RequestCommands that might be executed by this Consumer. |
javax.jms.Queue |
getQueue()
Returns the Consumer's Queue object. |
javax.jms.QueueConnection |
getQueueConnection()
Returns the Consumer's QueueConnection object. |
javax.jms.QueueConnectionFactory |
getQueueConnectionFactory()
Returns the Consumer's QueueConnectionFactory object. |
javax.jms.QueueReceiver |
getQueueReceiver()
Returns the Consumer's QueueReceiver object. |
javax.jms.QueueSession |
getQueueSession()
Returns the Consumer's QueueSession object. |
protected RequestCommand |
getRequestCommand(java.lang.String commandName)
Returns a RequestCommand from the HashMap of RequestCommands supported by this Consumer. |
protected javax.jms.Message |
handleRequest(int messageNumber,
javax.jms.Message aMessage)
RequestCommand execution routine. |
protected void |
init(java.util.Properties props)
Invokes MessageConsumer.init(Properties) and adds the ConsumerShutDownHook for this consumer. |
void |
initializeConsumer()
Calls the MessageConsumer initializeConsumer method to initialize any SyncCommands that this consumer may need to execute, then it initializes all RequestCommands associated to this consumer. |
protected void |
initRequestCommands()
Iterates through all RequestCommands that were listed in the CommandConfig objects associated to this Consumer in its deployment document and instantiates those RequestCommands by calling the addRequestCommand method. |
void |
setQueue(javax.jms.Queue queue)
Sets the Consumer's Queue object. |
void |
setQueueConnection(javax.jms.QueueConnection queueConnection)
Sets the Consumer's QueueConnection object. |
void |
setQueueConnectionFactory(javax.jms.QueueConnectionFactory qcf)
Sets the Consumer's QueueConnectionFactory object. |
void |
setQueueReceiver(javax.jms.QueueReceiver queueReceiver)
Sets the Consumer's QueueReceiver object. |
void |
setQueueSession(javax.jms.QueueSession session)
Sets the Consumer's QueueSession object. |
void |
startConsumer()
Starts the consumer making it ready to consume messages from the Queue 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 PointToPointConsumer()
public PointToPointConsumer(java.lang.String cFactory,
java.lang.String qName)
public PointToPointConsumer(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 javax.jms.QueueConnectionFactory getQueueConnectionFactory()
See the JMS Specification to learn more about JMS objects.
public void setQueueConnectionFactory(javax.jms.QueueConnectionFactory qcf)
See the JMS Specification to learn more about JMS objects.
public javax.jms.Queue getQueue()
See the JMS Specification to learn more about JMS objects.
public void setQueue(javax.jms.Queue queue)
See the JMS Specification to learn more about JMS objects.
public javax.jms.QueueConnection getQueueConnection()
See the JMS Specification to learn more about JMS objects.
public void setQueueConnection(javax.jms.QueueConnection queueConnection)
See the JMS Specification to learn more about JMS objects.
public javax.jms.QueueSession getQueueSession()
See the JMS Specification to learn more about JMS objects.
public void setQueueSession(javax.jms.QueueSession session)
See the JMS Specification to learn more about JMS objects.
public javax.jms.QueueReceiver getQueueReceiver()
See the JMS Specification to learn more about JMS objects.
public void setQueueReceiver(javax.jms.QueueReceiver queueReceiver)
See the JMS Specification to learn more about JMS objects.
public void initializeConsumer()
throws javax.jms.JMSException
initializeConsumer in class MessageConsumerjavax.jms.JMSException - if any errors occur initializing any of the Sync or
Request commands.MessageConsumer.initSyncCommands(),
initializeConsumer()
public void addRequestCommand(java.lang.String requestName,
java.lang.String className)
throws javax.jms.JMSException
It is here that the determination is made wether or not the command is the "default" or "absolute" command based on information found in the CommandConfig object associated to the Command.
javax.jms.JMSExceptionCommandConfig,
ConsumerConfig,
ConsumerCommand,
RequestCommand,
RequestCommandImpl,
SyncCommand,
SyncCommandImpl
protected void initRequestCommands()
throws javax.jms.JMSException
javax.jms.JMSException - if errors occur initializing the SyncCommandsaddRequestCommand(String, String)
protected RequestCommand getRequestCommand(java.lang.String commandName)
throws java.io.IOException
It will use the "COMMAND_NAME" JMS Property from the message to retrieve that RequestCommand from its list.
java.io.IOException - if a RequestCommand with the specified name cannot be found.
protected javax.jms.Message handleRequest(int messageNumber,
javax.jms.Message aMessage)
throws javax.jms.JMSException
The method will look for a JMS String property called "COMMAND_NAME" on the Message passed in. If the property is found, it will execute the RequestCommand associated to that name and return the output from that execution.
This property is automatically set by the OpenEAI Message Object API (MOA) foundation when a message is sent using an organization's MOA implementation (a business object).
If an "Absolute" command has been associated to the consumer, it will execute that command implementation NO MATTER what.
If no COMMAND_NAME is found on the Message passed in and there has been a "Default" command associated to the consumer, it will execute that command implementation.
If no COMMAND_NAME property exists and there has been no "Default" or "Absolute" command associated to this consumer, an error will occur.
If a COMMAND_NAME property DOES exist but it doesn't map to a known command implementation and no "Absolute" command has been specified, an error will occur.
javax.jms.JMSException - if errors occur executing the Command. Note, this should be a very
rare occurrence because Commands are generally responsible for handling their own errors.
The most common place where an exception might be thrown by a command is if it
had problems retrieving the data from the Message passed to it. Otherwise, the Command
should either publish a Sync-Error or return an Error to the requesting application depending
on the type of command being executed (RequestCommand vs. SyncCommand)
protected void init(java.util.Properties props)
throws java.io.IOException
init in class MessageConsumerjava.io.IOExceptionMessageConsumer.init(Properties)
public void startConsumer()
throws javax.jms.JMSException,
javax.naming.NamingException
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.NamingExceptionPubSubConsumer.startConsumer(),
PointToPointConsumer.MonitorConsumerpublic void stopConsumer()
stopConsumer in class MessageConsumerPointToPointConsumer.MonitorConsumer,
PointToPointConsumer.ConsumerShutdownHook
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||