|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jms.support.JmsAccessor org.springframework.jms.support.destination.JmsDestinationAccessor org.springframework.jms.core.JmsTemplate org.springframework.jms.core.JmsTemplate102
JmsTemplate
@Deprecated public class JmsTemplate102
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.
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(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 QueueBrowser |
createBrowser(Session session,
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 Connection |
createConnection()
Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API. |
protected MessageConsumer |
createConsumer(Session session,
Destination destination,
String messageSelector)
Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API. |
protected Session |
createSession(Connection con)
Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API. |
protected MessageProducer |
doCreateProducer(Session session,
Destination destination)
Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API. |
protected void |
doSend(MessageProducer producer,
Message message)
Deprecated. This implementation overrides the superclass method to use JMS 1.0.2 API. |
protected Connection |
getConnection(JmsResourceHolder holder)
Deprecated. This implementation overrides the superclass method to accept either a QueueConnection or a TopicConnection, depending on the domain. |
protected 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(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.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 |
---|
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.
JmsAccessor.setConnectionFactory(javax.jms.ConnectionFactory)
public JmsTemplate102(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)
Method Detail |
---|
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 Connection getConnection(JmsResourceHolder holder)
getConnection
in class JmsTemplate
holder
- the JmsResourceHolder
null
if none foundprotected Session getSession(JmsResourceHolder holder)
getSession
in class JmsTemplate
holder
- the JmsResourceHolder
null
if none foundprotected Connection createConnection() throws JMSException
createConnection
in class JmsAccessor
JMSException
- if thrown by JMS API methodsConnectionFactory.createConnection()
protected Session createSession(Connection con) throws JMSException
createSession
in class JmsAccessor
con
- the JMS Connection to create a Session for
JMSException
- if thrown by JMS API methodsConnection.createSession(boolean, int)
protected MessageProducer doCreateProducer(Session session, Destination destination) throws JMSException
doCreateProducer
in class JmsTemplate
session
- the JMS Session to create a MessageProducer fordestination
- the JMS Destination to create a MessageProducer for
JMSException
- if thrown by JMS API methodsprotected MessageConsumer createConsumer(Session session, Destination destination, String messageSelector) throws 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
)
JMSException
- if thrown by JMS API methodsprotected QueueBrowser createBrowser(Session session, Queue queue, String messageSelector) throws 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
)
JMSException
- if thrown by JMS API methodsJmsTemplate.setMessageIdEnabled(boolean)
,
JmsTemplate.setMessageTimestampEnabled(boolean)
protected void doSend(MessageProducer producer, Message message) throws JMSException
doSend
in class JmsTemplate
producer
- the JMS MessageProducer to send withmessage
- the JMS Message to send
JMSException
- if thrown by JMS API methodsprotected boolean isClientAcknowledge(Session session) throws 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 check
JMSException
- if thrown by JMS API methodsJmsAccessor.getSessionAcknowledgeMode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |