Spring Web Services Framework

org.springframework.ws.transport.jms
Class JmsMessageSender

java.lang.Object
  extended by org.springframework.jms.support.JmsAccessor
      extended by org.springframework.jms.support.destination.JmsDestinationAccessor
          extended by org.springframework.ws.transport.jms.JmsMessageSender
All Implemented Interfaces:
InitializingBean, WebServiceMessageSender

public class JmsMessageSender
extends JmsDestinationAccessor
implements WebServiceMessageSender

WebServiceMessageSender implementation that uses JMS Messages. Requires a JMS ConnectionFactory to operate.

This message sender supports URI's of the following format:

jms:destination[?param-name=param-value][&param-name=param-value]*
where the characters :, ?, and & stand for themselves. The destination represents the name of the Queue or Topic that will be resolved by the destination resolver. Valid param-name include:

param-nameDescription
deliveryModeIndicates whether the request message is persistent or not. This may be PERSISTENT or NON_PERSISTENT. See MessageProducer.setDeliveryMode(int)
messageTypeThe message type. This may be BINARY_MESSAGE (the default) or TEXT_MESSAGE
priorityThe JMS priority (0-9) associated with the request message. See MessageProducer.setPriority(int)
replyToNameThe name of the destination to which the response message must be sent, that will be resolved by the destination resolver.
timeToLiveThe lifetime, in milliseconds, of the request message. See MessageProducer.setTimeToLive(long)

If the replyToName is not set, a temporary queue is used.

This class uses BytesMessage messages by default, but can be configured to send TextMessage messages instead. Note that BytesMessages are prefered, since TextMessages do not support attachments and charactering encodings reliably.

Some examples of JMS URIs are:

jms:SomeQueue
jms:SomeTopic?priority=3&deliveryMode=NON_PERSISTENT
jms:RequestQueue?replyToName=ResponseQueueName
jms:Queue?messageType=TEXT_MESSAGE

Since:
1.5.0
Author:
Arjen Poutsma
See Also:
IRI Scheme for Java(tm) Message Service 1.0

Field Summary
static long DEFAULT_RECEIVE_TIMEOUT
          Default timeout for receive operations: -1 indicates a blocking receive without timeout.
static String DEFAULT_TEXT_MESSAGE_ENCODING
          Default encoding used to read fromn and write to TextMessage messages.
 
Fields inherited from class org.springframework.jms.support.JmsAccessor
logger
 
Constructor Summary
JmsMessageSender()
          Create a new JmsMessageSender

Note: The ConnectionFactory has to be set before using the instance.

JmsMessageSender(ConnectionFactory connectionFactory)
          Create a new JmsMessageSender, given a ConnectionFactory.
 
Method Summary
 WebServiceConnection createConnection(URI uri)
          Create a new WebServiceConnection to the specified URI.
 void setPostProcessor(MessagePostProcessor postProcessor)
          Sets the optional MessagePostProcessor to further modify outgoing messages after the XML contents has been set.
 void setReceiveTimeout(long receiveTimeout)
          Set the timeout to use for receive calls.
 void setTextMessageEncoding(String textMessageEncoding)
          Sets the encoding used to read from TextMessage messages.
 boolean supports(URI uri)
          Does this WebServiceMessageSender support the supplied URI?
 
Methods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
getDestinationResolver, isPubSubDomain, resolveDestinationName, setDestinationResolver, setPubSubDomain
 
Methods inherited from class org.springframework.jms.support.JmsAccessor
afterPropertiesSet, convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RECEIVE_TIMEOUT

public static final long DEFAULT_RECEIVE_TIMEOUT
Default timeout for receive operations: -1 indicates a blocking receive without timeout.

See Also:
Constant Field Values

DEFAULT_TEXT_MESSAGE_ENCODING

public static final String DEFAULT_TEXT_MESSAGE_ENCODING
Default encoding used to read fromn and write to TextMessage messages.

See Also:
Constant Field Values
Constructor Detail

JmsMessageSender

public JmsMessageSender()
Create a new JmsMessageSender

Note: The ConnectionFactory has to be set before using the instance. This constructor can be used to prepare a JmsTemplate via a BeanFactory, typically setting the ConnectionFactory via JmsAccessor.setConnectionFactory(ConnectionFactory).

See Also:
JmsAccessor.setConnectionFactory(ConnectionFactory)

JmsMessageSender

public JmsMessageSender(ConnectionFactory connectionFactory)
Create a new JmsMessageSender, given a ConnectionFactory.

Parameters:
connectionFactory - the ConnectionFactory to obtain Connections from
Method Detail

setReceiveTimeout

public void setReceiveTimeout(long receiveTimeout)
Set the timeout to use for receive calls. The default is -1, which means no timeout.

See Also:
MessageConsumer.receive(long)

setTextMessageEncoding

public void setTextMessageEncoding(String textMessageEncoding)
Sets the encoding used to read from TextMessage messages. Defaults to UTF-8.


setPostProcessor

public void setPostProcessor(MessagePostProcessor postProcessor)
Sets the optional MessagePostProcessor to further modify outgoing messages after the XML contents has been set.


createConnection

public WebServiceConnection createConnection(URI uri)
                                      throws IOException
Description copied from interface: WebServiceMessageSender
Create a new WebServiceConnection to the specified URI.

Specified by:
createConnection in interface WebServiceMessageSender
Parameters:
uri - the URI to open a connection to
Returns:
the new connection
Throws:
IOException - in case of I/O errors

supports

public boolean supports(URI uri)
Description copied from interface: WebServiceMessageSender
Does this WebServiceMessageSender support the supplied URI?

Specified by:
supports in interface WebServiceMessageSender
Parameters:
uri - the URI to be checked
Returns:
true if this WebServiceMessageSender supports the supplied URI

Spring Web Services Framework

Copyright © 2005-2010 The Spring Web Services Framework. All Rights Reserved.