public class

JmsTemplate102

extends JmsTemplate
java.lang.Object
   ↳ org.springframework.jms.support.JmsAccessor
     ↳ org.springframework.jms.support.destination.JmsDestinationAccessor
       ↳ org.springframework.jms.core.JmsTemplate
         ↳ org.springframework.jms.core.JmsTemplate102

This class is deprecated.
as of Spring 3.0, in favor of the JMS 1.1 based JmsTemplate

Class Overview

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.

See Also

Summary

[Expand]
Inherited Constants
From class org.springframework.jms.core.JmsTemplate
[Expand]
Inherited Fields
From class org.springframework.jms.support.JmsAccessor
Public Constructors
JmsTemplate102()
Create a new JmsTemplate102 for bean-style usage.
JmsTemplate102(ConnectionFactory connectionFactory, boolean pubSubDomain)
Create a new JmsTemplate102, given a ConnectionFactory.
Public Methods
void afterPropertiesSet()
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 Methods
QueueBrowser createBrowser(Session session, Queue queue, String messageSelector)
Create a JMS MessageProducer for the given Session and Destination, configuring it to disable message ids and/or timestamps (if necessary).
Connection createConnection()
This implementation overrides the superclass method to use JMS 1.0.2 API.
MessageConsumer createConsumer(Session session, Destination destination, String messageSelector)
This implementation overrides the superclass method to use JMS 1.0.2 API.
Session createSession(Connection con)
This implementation overrides the superclass method to use JMS 1.0.2 API.
MessageProducer doCreateProducer(Session session, Destination destination)
This implementation overrides the superclass method to use JMS 1.0.2 API.
void doSend(MessageProducer producer, Message message)
This implementation overrides the superclass method to use JMS 1.0.2 API.
Connection getConnection(JmsResourceHolder holder)
This implementation overrides the superclass method to accept either a QueueConnection or a TopicConnection, depending on the domain.
Session getSession(JmsResourceHolder holder)
This implementation overrides the superclass method to accept either a QueueSession or a TopicSession, depending on the domain.
void initDefaultStrategies()
Initialize the default implementations for the template's strategies: DynamicDestinationResolver and SimpleMessageConverter102.
boolean isClientAcknowledge(Session session)
This implementation overrides the superclass method to avoid using JMS 1.1's Session getAcknowledgeMode() method.
[Expand]
Inherited Methods
From class org.springframework.jms.core.JmsTemplate
From class org.springframework.jms.support.destination.JmsDestinationAccessor
From class org.springframework.jms.support.JmsAccessor
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.jms.core.JmsOperations

Public Constructors

public JmsTemplate102 ()

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.

public JmsTemplate102 (ConnectionFactory connectionFactory, boolean pubSubDomain)

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

Public Methods

public void afterPropertiesSet ()

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 Methods

protected QueueBrowser createBrowser (Session session, Queue queue, String messageSelector)

Create a JMS MessageProducer for the given Session and Destination, configuring it to disable message ids and/or timestamps (if necessary).

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

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
JMSException

protected Connection createConnection ()

This implementation overrides the superclass method to use JMS 1.0.2 API.

Returns
  • the new JMS Connection
Throws
JMSException

protected MessageConsumer createConsumer (Session session, Destination destination, String messageSelector)

This implementation overrides the superclass method to use JMS 1.0.2 API.

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
JMSException

protected Session createSession (Connection con)

This implementation overrides the superclass method to use JMS 1.0.2 API.

Parameters
con the JMS Connection to create a Session for
Returns
  • the new JMS Session
Throws
JMSException

protected MessageProducer doCreateProducer (Session session, Destination destination)

This implementation overrides the superclass method to use JMS 1.0.2 API.

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
JMSException

protected void doSend (MessageProducer producer, Message message)

This implementation overrides the superclass method to use JMS 1.0.2 API.

Parameters
producer the JMS MessageProducer to send with
message the JMS Message to send
Throws
JMSException

protected Connection getConnection (JmsResourceHolder holder)

This implementation overrides the superclass method to accept either a QueueConnection or a TopicConnection, depending on the domain.

Parameters
holder the JmsResourceHolder
Returns
  • an appropriate Connection fetched from the holder, or null if none found

protected Session getSession (JmsResourceHolder holder)

This implementation overrides the superclass method to accept either a QueueSession or a TopicSession, depending on the domain.

Parameters
holder the JmsResourceHolder
Returns
  • an appropriate Session fetched from the holder, or null if none found

protected void initDefaultStrategies ()

Initialize the default implementations for the template's strategies: DynamicDestinationResolver and SimpleMessageConverter102.

protected boolean isClientAcknowledge (Session session)

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.

Parameters
session the JMS Session to check
Returns
  • whether the given Session is in client acknowledge mode
Throws
JMSException