Spring Framework

org.springframework.jms.core
Class JmsTemplate102

java.lang.Object
  extended by org.springframework.jms.support.JmsAccessor
      extended by org.springframework.jms.support.destination.JmsDestinationAccessor
          extended by org.springframework.jms.core.JmsTemplate
              extended by org.springframework.jms.core.JmsTemplate102
All Implemented Interfaces:
InitializingBean, JmsOperations

Deprecated. as of Spring 3.0, in favor of the JMS 1.1 based JmsTemplate

@Deprecated
public class JmsTemplate102
extends JmsTemplate

A subclass of JmsTemplate for the JMS 1.0.2 specification, not relying on JMS 1.1 methods like JmsTemplate itself. This class can be used for JMS 1.0.2 providers, offering the same API as JmsTemplate does for JMS 1.1 providers.

You must specify the domain (or style) of messaging to be either Point-to-Point (Queues) or Publish/Subscribe (Topics), using the "pubSubDomain" property. Point-to-Point (Queues) is the default domain.

The "pubSubDomain" property is an important setting due to the use of similar but separate class hierarchies in the JMS 1.0.2 API. JMS 1.1 provides a new domain-independent API that allows for easy mix-and-match use of Point-to-Point and Publish/Subscribe styles.

This template uses a DynamicDestinationResolver and a SimpleMessageConverter102 as default strategies for resolving a destination name and converting a message, respectively.

Since:
1.1
Author:
Mark Pollack, Juergen Hoeller
See Also:
JmsAccessor.setConnectionFactory(javax.jms.ConnectionFactory), JmsDestinationAccessor.setPubSubDomain(boolean), Queue, Topic, QueueSession, TopicSession, QueueSender, TopicPublisher, QueueReceiver, TopicSubscriber

Field Summary
 
Fields inherited from class org.springframework.jms.core.JmsTemplate
RECEIVE_TIMEOUT_INDEFINITE_WAIT, RECEIVE_TIMEOUT_NO_WAIT
 
Fields inherited from class org.springframework.jms.support.JmsAccessor
logger
 
Constructor Summary
JmsTemplate102()
          Deprecated. Create a new JmsTemplate102 for bean-style usage.
JmsTemplate102(javax.jms.ConnectionFactory connectionFactory, boolean pubSubDomain)
          Deprecated. Create a new JmsTemplate102, given a ConnectionFactory.
 
Method Summary
 void afterPropertiesSet()
          Deprecated. In addition to checking if the connection factory is set, make sure that the supplied connection factory is of the appropriate type for the specified destination type: QueueConnectionFactory for queues, and TopicConnectionFactory for topics.
protected  javax.jms.QueueBrowser createBrowser(javax.jms.Session session, javax.jms.Queue queue, java.lang.String messageSelector)
          Deprecated. Create a JMS MessageProducer for the given Session and Destination, configuring it to disable message ids and/or timestamps (if necessary).
protected  javax.jms.Connection createConnection()
          Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API.
protected  javax.jms.MessageConsumer createConsumer(javax.jms.Session session, javax.jms.Destination destination, java.lang.String messageSelector)
          Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API.
protected  javax.jms.Session createSession(javax.jms.Connection con)
          Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API.
protected  javax.jms.MessageProducer doCreateProducer(javax.jms.Session session, javax.jms.Destination destination)
          Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API.
protected  void doSend(javax.jms.MessageProducer producer, javax.jms.Message message)
          Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API.
protected  javax.jms.Connection getConnection(JmsResourceHolder holder)
          Deprecated. This implementation overrides the superclass method to accept either a QueueConnection or a TopicConnection, depending on the domain.
protected  javax.jms.Session getSession(JmsResourceHolder holder)
          Deprecated. This implementation overrides the superclass method to accept either a QueueSession or a TopicSession, depending on the domain.
protected  void initDefaultStrategies()
          Deprecated. Initialize the default implementations for the template's strategies: DynamicDestinationResolver and SimpleMessageConverter102.
protected  boolean isClientAcknowledge(javax.jms.Session session)
          Deprecated. This implementation overrides the superclass method to avoid using JMS 1.1's Session getAcknowledgeMode() method.
 
Methods inherited from class org.springframework.jms.core.JmsTemplate
browse, browse, browse, browseSelected, browseSelected, browseSelected, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, convertAndSend, createProducer, doConvertFromMessage, doReceive, doReceive, doSend, execute, execute, execute, execute, execute, getDefaultDestination, getDefaultDestinationName, getDeliveryMode, getMessageConverter, getPriority, getReceiveTimeout, getTimeToLive, isExplicitQosEnabled, isMessageIdEnabled, isMessageTimestampEnabled, isPubSubNoLocal, isSessionLocallyTransacted, receive, receive, receive, receiveAndConvert, receiveAndConvert, receiveAndConvert, receiveSelected, receiveSelected, receiveSelected, receiveSelectedAndConvert, receiveSelectedAndConvert, receiveSelectedAndConvert, send, send, send, setDefaultDestination, setDefaultDestinationName, setDeliveryMode, setDeliveryPersistent, setExplicitQosEnabled, setMessageConverter, setMessageIdEnabled, setMessageTimestampEnabled, setPriority, setPubSubNoLocal, setReceiveTimeout, setTimeToLive
 
Methods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor
getDestinationResolver, isPubSubDomain, resolveDestinationName, setDestinationResolver, setPubSubDomain
 
Methods inherited from class org.springframework.jms.support.JmsAccessor
convertJmsAccessException, getConnectionFactory, getSessionAcknowledgeMode, isSessionTransacted, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JmsTemplate102

public JmsTemplate102()
Deprecated. 
Create a new JmsTemplate102 for bean-style usage.

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 setConnectionFactory.

See Also:
JmsAccessor.setConnectionFactory(javax.jms.ConnectionFactory)

JmsTemplate102

public JmsTemplate102(javax.jms.ConnectionFactory connectionFactory,
                      boolean pubSubDomain)
Deprecated. 
Create a new JmsTemplate102, given a ConnectionFactory.

Parameters:
connectionFactory - the ConnectionFactory to obtain Connections from
pubSubDomain - whether the Publish/Subscribe domain (Topics) or Point-to-Point domain (Queues) should be used
See Also:
JmsDestinationAccessor.setPubSubDomain(boolean)
Method Detail

initDefaultStrategies

protected void initDefaultStrategies()
Deprecated. 
Initialize the default implementations for the template's strategies: DynamicDestinationResolver and SimpleMessageConverter102.

Overrides:
initDefaultStrategies in class JmsTemplate
See Also:
JmsDestinationAccessor.setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver), JmsTemplate.setMessageConverter(org.springframework.jms.support.converter.MessageConverter), DynamicDestinationResolver, SimpleMessageConverter102

afterPropertiesSet

public void afterPropertiesSet()
Deprecated. 
In addition to checking if the connection factory is set, make sure that the supplied connection factory is of the appropriate type for the specified destination type: QueueConnectionFactory for queues, and TopicConnectionFactory for topics.

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class JmsAccessor

getConnection

protected javax.jms.Connection getConnection(JmsResourceHolder holder)
Deprecated. 
This implementation overrides the superclass method to accept either a QueueConnection or a TopicConnection, depending on the domain.

Overrides:
getConnection in class JmsTemplate
Parameters:
holder - the JmsResourceHolder
Returns:
an appropriate Connection fetched from the holder, or null if none found

getSession

protected javax.jms.Session getSession(JmsResourceHolder holder)
Deprecated. 
This implementation overrides the superclass method to accept either a QueueSession or a TopicSession, depending on the domain.

Overrides:
getSession in class JmsTemplate
Parameters:
holder - the JmsResourceHolder
Returns:
an appropriate Session fetched from the holder, or null if none found

createConnection

protected javax.jms.Connection createConnection()
                                         throws javax.jms.JMSException
Deprecated. 
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
createConnection in class JmsAccessor
Returns:
the new JMS Connection
Throws:
javax.jms.JMSException - if thrown by JMS API methods
See Also:
ConnectionFactory.createConnection()

createSession

protected javax.jms.Session createSession(javax.jms.Connection con)
                                   throws javax.jms.JMSException
Deprecated. 
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
createSession in class JmsAccessor
Parameters:
con - the JMS Connection to create a Session for
Returns:
the new JMS Session
Throws:
javax.jms.JMSException - if thrown by JMS API methods
See Also:
Connection.createSession(boolean, int)

doCreateProducer

protected javax.jms.MessageProducer doCreateProducer(javax.jms.Session session,
                                                     javax.jms.Destination destination)
                                              throws javax.jms.JMSException
Deprecated. 
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
doCreateProducer in class JmsTemplate
Parameters:
session - the JMS Session to create a MessageProducer for
destination - the JMS Destination to create a MessageProducer for
Returns:
the new JMS MessageProducer
Throws:
javax.jms.JMSException - if thrown by JMS API methods

createConsumer

protected javax.jms.MessageConsumer createConsumer(javax.jms.Session session,
                                                   javax.jms.Destination destination,
                                                   java.lang.String messageSelector)
                                            throws javax.jms.JMSException
Deprecated. 
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
createConsumer in class JmsTemplate
Parameters:
session - the JMS Session to create a MessageConsumer for
destination - the JMS Destination to create a MessageConsumer for
messageSelector - the message selector for this consumer (can be null)
Returns:
the new JMS MessageConsumer
Throws:
javax.jms.JMSException - if thrown by JMS API methods

createBrowser

protected javax.jms.QueueBrowser createBrowser(javax.jms.Session session,
                                               javax.jms.Queue queue,
                                               java.lang.String messageSelector)
                                        throws javax.jms.JMSException
Deprecated. 
Description copied from class: JmsTemplate
Create a JMS MessageProducer for the given Session and Destination, configuring it to disable message ids and/or timestamps (if necessary).

Delegates to JmsTemplate.doCreateProducer(javax.jms.Session, javax.jms.Destination) for creation of the raw JMS MessageProducer, which needs to be specific to JMS 1.1 or 1.0.2.

Overrides:
createBrowser in class JmsTemplate
Parameters:
session - the JMS Session to create a QueueBrowser for
queue - the JMS Queue to create a QueueBrowser for
messageSelector - the message selector for this consumer (can be null)
Returns:
the new JMS QueueBrowser
Throws:
javax.jms.JMSException - if thrown by JMS API methods
See Also:
JmsTemplate.setMessageIdEnabled(boolean), JmsTemplate.setMessageTimestampEnabled(boolean)

doSend

protected void doSend(javax.jms.MessageProducer producer,
                      javax.jms.Message message)
               throws javax.jms.JMSException
Deprecated. 
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
doSend in class JmsTemplate
Parameters:
producer - the JMS MessageProducer to send with
message - the JMS Message to send
Throws:
javax.jms.JMSException - if thrown by JMS API methods

isClientAcknowledge

protected boolean isClientAcknowledge(javax.jms.Session session)
                               throws javax.jms.JMSException
Deprecated. 
This implementation overrides the superclass method to avoid using JMS 1.1's Session getAcknowledgeMode() method. The best we can do here is to check the setting on the template.

Overrides:
isClientAcknowledge in class JmsAccessor
Parameters:
session - the JMS Session to check
Returns:
whether the given Session is in client acknowledge mode
Throws:
javax.jms.JMSException - if thrown by JMS API methods
See Also:
JmsAccessor.getSessionAcknowledgeMode()

Spring Framework