org.openeai.jms.consumer.commands
Interface RequestCommand


public interface RequestCommand

The interface implmented by all RequestCommands and specifies that they must implement the 'execute' method which returns a JMS Message. These commands will be executed by the PointToPointConsumer when the JMSReplyTo property on a JMS message is not empty. The message returned by the RequestCommand will be returned to the calling application by the PointToPointConsumer.

Version:
3.0 - 28 January 2003
Author:
Tod Jackson (tod@openeai.org), Steve Wheat (steve@openeai.org)
See Also:
SyncCommand

Method Summary
 javax.jms.Message execute(int messageNumber, javax.jms.Message aMessage)
          Method used to implement business logic specific to a message or set of messages consumed by a OpenEAI PointToPointConsumer.
 void shutdown()
           
 

Method Detail

execute

javax.jms.Message execute(int messageNumber,
                          javax.jms.Message aMessage)
                          throws CommandException
Method used to implement business logic specific to a message or set of messages consumed by a OpenEAI PointToPointConsumer. When a consumer consumes a message it determines which RequestCommand implementation to execute and calls this method passing the JMS Message. The command then retrieves the body of the message and converts that into an XML Document (org.jdom.Document). Then the command executes business logic appropriate to it based on the contents of the message.

NOTE: The consumer only instantiates one instance of these commands (for each one supported by the consumer). If the consumer is configured to be multi-threaded, it will be calling the execute method on a single instance of the command associated to the message it consumed. Therefore, it is very important that the execute method be thread safe.

Parameters:
messageNumber, - convenience parm that is maintained by the PointToPointConsumer that will execute the command. This information can then be used in the Command to associate a specific line of execution back to the message number in the consumer.
aMessage - the JMS Message delivered to the PointToPointConsumer.

Returns:
Message the JMS Message that should be returned to the calling application after the command has performed its business logic.

Throws:
CommandException. - Generally, this exception should only ever be thrown if the Command has trouble turning the message body of the JMS Message passed to the execute method into an XML Document (org.jdom.Document). Any other error encountered by the command should be handled accordingly by returning a Reply document with errors indicating the nature of the problem.
CommandException
See Also:
SyncCommand.execute

shutdown

void shutdown()
              throws CommandException
Throws:
CommandException


Copyright © 2002,2003 OpenEAI Software Foundation