JmsTemplate
@Deprecated public class JmsTemplate102 extends JmsTemplate
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.
JmsAccessor.setConnectionFactory(javax.jms.ConnectionFactory)
,
JmsDestinationAccessor.setPubSubDomain(boolean)
,
Queue
,
Topic
,
QueueSession
,
TopicSession
,
QueueSender
,
TopicPublisher
,
QueueReceiver
,
TopicSubscriber
RECEIVE_TIMEOUT_INDEFINITE_WAIT, RECEIVE_TIMEOUT_NO_WAIT
logger
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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,
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,
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. |
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
getDestinationResolver, isPubSubDomain, resolveDestinationName, setDestinationResolver, setPubSubDomain
convertJmsAccessException, getConnectionFactory, getSessionAcknowledgeMode, isSessionTransacted, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted
public JmsTemplate102()
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(javax.jms.ConnectionFactory connectionFactory, boolean pubSubDomain)
connectionFactory
- the ConnectionFactory to obtain Connections frompubSubDomain
- whether the Publish/Subscribe domain (Topics) or
Point-to-Point domain (Queues) should be usedJmsDestinationAccessor.setPubSubDomain(boolean)
protected void initDefaultStrategies()
initDefaultStrategies
in class JmsTemplate
JmsDestinationAccessor.setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver)
,
JmsTemplate.setMessageConverter(org.springframework.jms.support.converter.MessageConverter)
,
DynamicDestinationResolver
,
SimpleMessageConverter102
public void afterPropertiesSet()
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class JmsAccessor
protected javax.jms.Connection getConnection(JmsResourceHolder holder)
getConnection
in class JmsTemplate
holder
- the JmsResourceHoldernull
if none foundprotected javax.jms.Session getSession(JmsResourceHolder holder)
getSession
in class JmsTemplate
holder
- the JmsResourceHoldernull
if none foundprotected javax.jms.Connection createConnection() throws javax.jms.JMSException
createConnection
in class JmsAccessor
javax.jms.JMSException
- if thrown by JMS API methodsConnectionFactory.createConnection()
protected javax.jms.Session createSession(javax.jms.Connection con) throws javax.jms.JMSException
createSession
in class JmsAccessor
con
- the JMS Connection to create a Session forjavax.jms.JMSException
- if thrown by JMS API methodsConnection.createSession(boolean, int)
protected javax.jms.MessageProducer doCreateProducer(javax.jms.Session session, javax.jms.Destination destination) throws javax.jms.JMSException
doCreateProducer
in class JmsTemplate
session
- the JMS Session to create a MessageProducer fordestination
- the JMS Destination to create a MessageProducer forjavax.jms.JMSException
- if thrown by JMS API methodsprotected javax.jms.MessageConsumer createConsumer(javax.jms.Session session, javax.jms.Destination destination, String messageSelector) throws javax.jms.JMSException
createConsumer
in class JmsTemplate
session
- the JMS Session to create a MessageConsumer fordestination
- the JMS Destination to create a MessageConsumer formessageSelector
- the message selector for this consumer (can be null
)javax.jms.JMSException
- if thrown by JMS API methodsprotected javax.jms.QueueBrowser createBrowser(javax.jms.Session session, javax.jms.Queue queue, String messageSelector) throws javax.jms.JMSException
JmsTemplate
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.
createBrowser
in class JmsTemplate
session
- the JMS Session to create a QueueBrowser forqueue
- the JMS Queue to create a QueueBrowser formessageSelector
- the message selector for this consumer (can be null
)javax.jms.JMSException
- if thrown by JMS API methodsJmsTemplate.setMessageIdEnabled(boolean)
,
JmsTemplate.setMessageTimestampEnabled(boolean)
protected void doSend(javax.jms.MessageProducer producer, javax.jms.Message message) throws javax.jms.JMSException
doSend
in class JmsTemplate
producer
- the JMS MessageProducer to send withmessage
- the JMS Message to sendjavax.jms.JMSException
- if thrown by JMS API methodsprotected boolean isClientAcknowledge(javax.jms.Session session) throws javax.jms.JMSException
getAcknowledgeMode()
method.
The best we can do here is to check the setting on the template.isClientAcknowledge
in class JmsAccessor
session
- the JMS Session to checkjavax.jms.JMSException
- if thrown by JMS API methodsJmsAccessor.getSessionAcknowledgeMode()
Copyright © 2015. All rights reserved.