NOTE: This class requires a JMS 1.1+ provider because it builds on the domain-independent API. Use the {@link JmsTemplate102} subclassfor a JMS 1.0.2 provider, e.g. when running on a J2EE 1.3 server.
If you want to use dynamic destination creation, you must specify the type of JMS destination to create, using the "pubSubDomain" property. For other operations, this is not necessary, in contrast to when working with JmsTemplate102. Point-to-Point (Queues) is the default domain.
Default settings for JMS Sessions are "not transacted" and "auto-acknowledge". As defined by the J2EE specification, the transaction and acknowledgement parameters are ignored when a JMS Session is created inside an active transaction, no matter if a JTA transaction or a Spring-managed transaction. To configure them for native JMS usage, specify appropriate values for the "sessionTransacted" and "sessionAcknowledgeMode" bean properties.
This template uses a {@link org.springframework.jms.support.destination.DynamicDestinationResolver}and a {@link org.springframework.jms.support.converter.SimpleMessageConverter}as default strategies for resolving a destination name or converting a message, respectively. These defaults can be overridden through the "destinationResolver" and "messageConverter" bean properties.
NOTE: The ConnectionFactory
used with this template should return pooled Connections (or a single shared Connection) as well as pooled Sessions and MessageProducers. Otherwise, performance of ad-hoc JMS operations is going to suffer. The simplest option is to use the Spring-provided {@link org.springframework.jms.connection.SingleConnectionFactory} as adecorator for your target ConnectionFactory
, reusing a single JMS Connection in a thread-safe fashion; this is often good enough for the purpose of sending messages via this template. In a J2EE environment, make sure that the ConnectionFactory
is obtained from the application's environment naming context via JNDI; application servers typically expose pooled, transaction-aware factories there.
@author Mark Pollack
@author Juergen Hoeller
@since 1.1
@see #setConnectionFactory
@see #setPubSubDomain
@see #setDestinationResolver
@see #setMessageConverter
@see JmsTemplate102
@see javax.jms.MessageProducer
@see javax.jms.MessageConsumer
|
|
|
|