com.consol.citrus.jms
Class JmsSyncMessageSender

java.lang.Object
  extended by com.consol.citrus.jms.JmsSyncMessageSender
All Implemented Interfaces:
MessageSender, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean

public class JmsSyncMessageSender
extends Object
implements MessageSender, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean

Synchronous message sender implementation for JMS. Sender publishes messages to a JMS destination and sets the reply destination in the request message. Sender consumes the reply destination right away and invokes a reply message handler implementation with this reply message. Class can either define a static reply destination or a temporary reply destination.

Author:
Christoph Deppisch

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.consol.citrus.message.MessageSender
MessageSender.ErrorHandlingStrategy
 
Constructor Summary
JmsSyncMessageSender()
           
 
Method Summary
protected  void createConnection()
          Create new JMS connection.
protected  void createSession(javax.jms.Connection connection)
          Create new JMS session.
 void destroy()
          Destroy method closing JMS session and connection
 TestActor getActor()
          Gets the actor.
 javax.jms.ConnectionFactory getConnectionFactory()
          Gets the connectionFactory.
 ReplyMessageCorrelator getCorrelator()
          Gets the correlator.
protected  String getDefaultDestinationName()
          Get the destination name (either queue name or topic name).
 javax.jms.Destination getDestination()
          Gets the destination.
 String getDestinationName()
          Gets the destinationName.
 javax.jms.Destination getReplyDestination()
          Gets the replyDestination.
 String getReplyDestinationName()
          Gets the replyDestinationName.
 ReplyMessageHandler getReplyMessageHandler()
          Get the reply message handler.
 long getReplyTimeout()
          Gets the replyTimeout.
protected  void informReplyMessageHandler(org.springframework.integration.Message<?> responseMessage, org.springframework.integration.Message<?> requestMessage)
          Informs reply message handler for further processing of reply message.
 boolean isPubSubDomain()
          Is this sender using JMS topics instead of JMS queues.
 void send(org.springframework.integration.Message<?> message)
          Sends the message.
 void setActor(TestActor actor)
          Sets the actor.
 void setBeanName(String name)
           
 void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
          Set the connection factory.
 void setCorrelator(ReplyMessageCorrelator correlator)
          Set the reply message correlator.
 void setDestination(javax.jms.Destination destination)
          Set the send destination.
 void setDestinationName(String destinationName)
          Set the send destination name.
 void setPubSubDomain(boolean pubSubDomain)
          Set whether to use JMS topics instead of JMS queues.
 void setReplyDestination(javax.jms.Destination replyDestination)
          Set the reply destination.
 void setReplyDestinationName(String replyDestinationName)
          Set the reply destination name.
 void setReplyMessageHandler(ReplyMessageHandler replyMessageHandler)
          Set the reply message handler.
 void setReplyTimeout(long replyTimeout)
          Set the reply message timeout.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsSyncMessageSender

public JmsSyncMessageSender()
Method Detail

send

public void send(org.springframework.integration.Message<?> message)
Description copied from interface: MessageSender
Sends the message.

Specified by:
send in interface MessageSender
Parameters:
message - the message object to send.
Throws:
CitrusRuntimeException
See Also:
MessageSender.send(org.springframework.integration.Message)

informReplyMessageHandler

protected void informReplyMessageHandler(org.springframework.integration.Message<?> responseMessage,
                                         org.springframework.integration.Message<?> requestMessage)
Informs reply message handler for further processing of reply message.

Parameters:
responseMessage - the reply message.
requestMessage - the initial request message.

getDefaultDestinationName

protected String getDefaultDestinationName()
Get the destination name (either queue name or topic name).

Returns:
the destinationName

createConnection

protected void createConnection()
                         throws javax.jms.JMSException
Create new JMS connection.

Throws:
javax.jms.JMSException

createSession

protected void createSession(javax.jms.Connection connection)
                      throws javax.jms.JMSException
Create new JMS session.

Parameters:
connection - to use for session creation.
Throws:
javax.jms.JMSException

destroy

public void destroy()
             throws Exception
Destroy method closing JMS session and connection

Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Throws:
Exception

setConnectionFactory

public void setConnectionFactory(javax.jms.ConnectionFactory connectionFactory)
Set the connection factory.

Parameters:
connectionFactory - the connectionFactory to set

setReplyMessageHandler

public void setReplyMessageHandler(ReplyMessageHandler replyMessageHandler)
Set the reply message handler.

Parameters:
replyMessageHandler - the replyMessageHandler to set

getReplyMessageHandler

public ReplyMessageHandler getReplyMessageHandler()
Get the reply message handler.

Returns:
the replyMessageHandler

setDestination

public void setDestination(javax.jms.Destination destination)
Set the send destination.

Parameters:
destination - the destination to set

setDestinationName

public void setDestinationName(String destinationName)
Set the send destination name.

Parameters:
destinationName - the destinationName to set

setReplyDestination

public void setReplyDestination(javax.jms.Destination replyDestination)
Set the reply destination.

Parameters:
replyDestination - the replyDestination to set

setReplyDestinationName

public void setReplyDestinationName(String replyDestinationName)
Set the reply destination name.

Parameters:
replyDestinationName - the replyDestinationName to set

setReplyTimeout

public void setReplyTimeout(long replyTimeout)
Set the reply message timeout.

Parameters:
replyTimeout - the replyTimeout to set

setCorrelator

public void setCorrelator(ReplyMessageCorrelator correlator)
Set the reply message correlator.

Parameters:
correlator - the correlator to set

setPubSubDomain

public void setPubSubDomain(boolean pubSubDomain)
Set whether to use JMS topics instead of JMS queues.

Parameters:
pubSubDomain - the pubSubDomain to set

isPubSubDomain

public boolean isPubSubDomain()
Is this sender using JMS topics instead of JMS queues.

Returns:
the pubSubDomain

setBeanName

public void setBeanName(String name)
Specified by:
setBeanName in interface org.springframework.beans.factory.BeanNameAware
See Also:
BeanNameAware.setBeanName(java.lang.String)

getConnectionFactory

public javax.jms.ConnectionFactory getConnectionFactory()
Gets the connectionFactory.

Returns:
the connectionFactory

getDestination

public javax.jms.Destination getDestination()
Gets the destination.

Returns:
the destination

getDestinationName

public String getDestinationName()
Gets the destinationName.

Returns:
the destinationName

getReplyDestination

public javax.jms.Destination getReplyDestination()
Gets the replyDestination.

Returns:
the replyDestination

getReplyDestinationName

public String getReplyDestinationName()
Gets the replyDestinationName.

Returns:
the replyDestinationName

getReplyTimeout

public long getReplyTimeout()
Gets the replyTimeout.

Returns:
the replyTimeout

getCorrelator

public ReplyMessageCorrelator getCorrelator()
Gets the correlator.

Returns:
the correlator

getActor

public TestActor getActor()
Gets the actor.

Specified by:
getActor in interface MessageSender
Returns:
the actor the actor to get.

setActor

public void setActor(TestActor actor)
Sets the actor.

Parameters:
actor - the actor to set


Copyright © 2008-2013 ConSol* Consulting&Solutions GmbH. All Rights Reserved.