org.osesb.connectors.jms
Class SynchronousSendMessageHelper

java.lang.Object
  extended by org.osesb.connectors.jms.SynchronousSendMessageHelper

public class SynchronousSendMessageHelper
extends java.lang.Object

This class uses properties given by the <synchronous-jms-configuration> extension to the JMSClientConfiguration to set up request/reply interactions on behalf of JMS clients that send a message and wait for a reply. The sendSynchronousJMSMessage() method of JMSQueueSender and JMSTopicPublisher uses this Class to receive the reply to a synchronous message.

Since:
Version .9

Field Summary
protected  JMSClientConfiguration jmsClientConfiguration
          The JMS configuration for this SynchronousSendMessageHelper, which must include a <synchronous-jms-configuration> content model.
protected  JNDIHelper jndiHelper
          Lazy instantiation in getReplyReceiver() for looking up non-pooled, JMS Consumers configured in the <synchronous-jms-configuration> content model.
protected  java.lang.String thisClassName
          The full name of this class.
 
Constructor Summary
SynchronousSendMessageHelper(JMSClientConfiguration jmsClientConfiguration)
          Creates a new instance of SynchronousSendMessageHelper
 
Method Summary
 javax.jms.Message getReply(javax.jms.Message jmsMessage)
          Gets a reply to a JMS message.
protected  JMSConsumerBase getReplyReceiver(javax.jms.Message jmsMessage)
          Uses properties given by the <synchronous-jms-configuration> to return a JMSConsumerBase as a JMSQueueReceiver or JMSTopicReceiver, depending on the replyToDestination type.
protected  javax.jms.Destination getReplyToDestination()
          Uses properties given by the <synchronous-jms-configuration> to return a ReplyTo Destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jmsClientConfiguration

protected JMSClientConfiguration jmsClientConfiguration
The JMS configuration for this SynchronousSendMessageHelper, which must include a <synchronous-jms-configuration> content model.


jndiHelper

protected JNDIHelper jndiHelper
Lazy instantiation in getReplyReceiver() for looking up non-pooled, JMS Consumers configured in the <synchronous-jms-configuration> content model. Never instantiated if the reply to receiver is pooled.


thisClassName

protected java.lang.String thisClassName
The full name of this class.

Constructor Detail

SynchronousSendMessageHelper

public SynchronousSendMessageHelper(JMSClientConfiguration jmsClientConfiguration)
                             throws java.lang.Exception
Creates a new instance of SynchronousSendMessageHelper

Parameters:
jmsClientConfiguration - The JMSClientConfiguration object to use for this helper. Note that if constructed by a JMSProducer, then this will probably be the JMSClientConfiguration for that producer.
Throws:
java.lang.Exception - if constructed with a null JMSClientConfiguration or with a jmsClientConfiguration with a null or empty synchJMSConfiguration.
Method Detail

getReply

public javax.jms.Message getReply(javax.jms.Message jmsMessage)
                           throws java.lang.Exception
Gets a reply to a JMS message.

Parameters:
jmsMessage - The message for which we are getting a reply.
Returns:
the reply JMS Message.
Throws:
java.lang.Exception - if there is a problem receiving the reply.

getReplyToDestination

protected javax.jms.Destination getReplyToDestination()
                                               throws java.lang.Exception
Uses properties given by the <synchronous-jms-configuration> to return a ReplyTo Destination.

Discovers the replyToDestination according to the following plan:

  1. First, it checks for a valid jmsPoolKey in a pool of JMS clients, which is configured for the project.
  2. Second, it checks the jmsClientConfiguration for the configured replyToQueue.
  3. Third, it checks the jmsClientConfiguration for the configured replyToTopic.

Returns:
A JMS Destination.
Throws:
java.lang.Exception - if there is a problem getting the Destination.

getReplyReceiver

protected JMSConsumerBase getReplyReceiver(javax.jms.Message jmsMessage)
                                    throws java.lang.Exception
Uses properties given by the <synchronous-jms-configuration> to return a JMSConsumerBase as a JMSQueueReceiver or JMSTopicReceiver, depending on the replyToDestination type.

Obtains a JMSConsumerBase according to the following plan:

  1. First, it checks for a valid jmsPoolKey in a pool of JMS clients, which is configured for the project.
  2. Second, it checks the jmsClientConfiguration for the configured replyToQueue.
  3. Third, it checks the jmsClientConfiguration for the configured replyToTopic.
  4. Fourth it checks for a destination returned by getJMSReplyTo().

Returns:
A JMSConsumerBase as a JMSQueueReceiver or JMSTopicReceiver.
Throws:
java.lang.Exception - if there is a problem getting the JMSProducer.