|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.jms.support.JmsAccessor
org.springframework.jms.support.destination.JmsDestinationAccessor
org.springframework.jms.core.JmsTemplate
public class JmsTemplate
Helper class that simplifies synchronous JMS access code.
NOTE: This class requires a JMS 1.1+ provider because it builds
on the domain-independent API. Use the JmsTemplate102 subclass
for 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
DynamicDestinationResolver
and a 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
SingleConnectionFactory as a
decorator 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.
JmsAccessor.setConnectionFactory(javax.jms.ConnectionFactory),
JmsDestinationAccessor.setPubSubDomain(boolean),
JmsDestinationAccessor.setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver),
setMessageConverter(org.springframework.jms.support.converter.MessageConverter),
JmsTemplate102,
MessageProducer,
MessageConsumer| Field Summary | |
|---|---|
static long |
RECEIVE_TIMEOUT_INDEFINITE_WAIT
Timeout value indicating a blocking receive without timeout. |
static long |
RECEIVE_TIMEOUT_NO_WAIT
Timeout value indicating that a receive operation should check if a message is immediately available without blocking. |
| Fields inherited from class org.springframework.jms.support.JmsAccessor |
|---|
logger |
| Constructor Summary | |
|---|---|
JmsTemplate()
Create a new JmsTemplate for bean-style usage. |
|
JmsTemplate(ConnectionFactory connectionFactory)
Create a new JmsTemplate, given a ConnectionFactory. |
|
| Method Summary | |
|---|---|
Object |
browse(BrowserCallback action)
Browse messages in the default JMS queue. |
Object |
browse(Queue queue,
BrowserCallback action)
Browse messages in a JMS queue. |
Object |
browse(String queueName,
BrowserCallback action)
Browse messages in a JMS queue. |
Object |
browseSelected(Queue queue,
String messageSelector,
BrowserCallback action)
Browse selected messages in a JMS queue. |
Object |
browseSelected(String messageSelector,
BrowserCallback action)
Browse selected messages in a JMS queue. |
Object |
browseSelected(String queueName,
String messageSelector,
BrowserCallback action)
Browse selected messages in a JMS queue. |
void |
convertAndSend(Destination destination,
Object message)
Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. |
void |
convertAndSend(Destination destination,
Object message,
MessagePostProcessor postProcessor)
Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. |
void |
convertAndSend(Object message)
Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter. |
void |
convertAndSend(Object message,
MessagePostProcessor postProcessor)
Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter. |
void |
convertAndSend(String destinationName,
Object message)
Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. |
void |
convertAndSend(String destinationName,
Object message,
MessagePostProcessor postProcessor)
Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. |
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). |
protected MessageConsumer |
createConsumer(Session session,
Destination destination,
String messageSelector)
Create a JMS MessageConsumer for the given Session and Destination. |
protected MessageProducer |
createProducer(Session session,
Destination destination)
Create a JMS MessageProducer for the given Session and Destination, configuring it to disable message ids and/or timestamps (if necessary). |
protected Object |
doConvertFromMessage(Message message)
Extract the content from the given JMS message. |
protected MessageProducer |
doCreateProducer(Session session,
Destination destination)
Create a raw JMS MessageProducer for the given Session and Destination. |
protected Message |
doReceive(Session session,
Destination destination,
String messageSelector)
Receive a JMS message. |
protected Message |
doReceive(Session session,
MessageConsumer consumer)
Actually receive a JMS message. |
protected void |
doSend(MessageProducer producer,
Message message)
Actually send the given JMS message. |
protected void |
doSend(Session session,
Destination destination,
MessageCreator messageCreator)
Send the given JMS message. |
Object |
execute(Destination destination,
ProducerCallback action)
Send messages to a JMS destination. |
Object |
execute(ProducerCallback action)
Send messages to the default JMS destination (or one specified for each send operation). |
Object |
execute(SessionCallback action)
Execute the action specified by the given action object within a JMS Session. |
Object |
execute(SessionCallback action,
boolean startConnection)
Execute the action specified by the given action object within a JMS Session. |
Object |
execute(String destinationName,
ProducerCallback action)
Send messages to a JMS destination. |
protected Connection |
getConnection(JmsResourceHolder holder)
Fetch an appropriate Connection from the given JmsResourceHolder. |
Destination |
getDefaultDestination()
Return the destination to be used on send/receive operations that do not have a destination parameter. |
String |
getDefaultDestinationName()
Return the destination name to be used on send/receive operations that do not have a destination parameter. |
int |
getDeliveryMode()
Return the delivery mode to use when sending a message. |
MessageConverter |
getMessageConverter()
Return the message converter for this template. |
int |
getPriority()
Return the priority of a message when sending. |
long |
getReceiveTimeout()
Return the timeout to use for receive calls (in milliseconds). |
protected Session |
getSession(JmsResourceHolder holder)
Fetch an appropriate Session from the given JmsResourceHolder. |
long |
getTimeToLive()
Return the time-to-live of the message when sending. |
protected void |
initDefaultStrategies()
Initialize the default implementations for the template's strategies: DynamicDestinationResolver and SimpleMessageConverter. |
boolean |
isExplicitQosEnabled()
If "true", then the values of deliveryMode, priority, and timeToLive will be used when sending a message. |
boolean |
isMessageIdEnabled()
Return whether message IDs are enabled. |
boolean |
isMessageTimestampEnabled()
Return whether message timestamps are enabled. |
boolean |
isPubSubNoLocal()
Return whether to inhibit the delivery of messages published by its own connection. |
protected boolean |
isSessionLocallyTransacted(Session session)
Check whether the given Session is locally transacted, that is, whether its transaction is managed by this listener container's Session handling and not by an external transaction coordinator. |
Message |
receive()
Receive a message synchronously from the default destination, but only wait up to a specified time for delivery. |
Message |
receive(Destination destination)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Message |
receive(String destinationName)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Object |
receiveAndConvert()
Receive a message synchronously from the default destination, but only wait up to a specified time for delivery. |
Object |
receiveAndConvert(Destination destination)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Object |
receiveAndConvert(String destinationName)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Message |
receiveSelected(Destination destination,
String messageSelector)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Message |
receiveSelected(String messageSelector)
Receive a message synchronously from the default destination, but only wait up to a specified time for delivery. |
Message |
receiveSelected(String destinationName,
String messageSelector)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Object |
receiveSelectedAndConvert(Destination destination,
String messageSelector)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
Object |
receiveSelectedAndConvert(String messageSelector)
Receive a message synchronously from the default destination, but only wait up to a specified time for delivery. |
Object |
receiveSelectedAndConvert(String destinationName,
String messageSelector)
Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. |
void |
send(Destination destination,
MessageCreator messageCreator)
Send a message to the specified destination. |
void |
send(MessageCreator messageCreator)
Send a message to the default destination. |
void |
send(String destinationName,
MessageCreator messageCreator)
Send a message to the specified destination. |
void |
setDefaultDestination(Destination destination)
Set the destination to be used on send/receive operations that do not have a destination parameter. |
void |
setDefaultDestinationName(String destinationName)
Set the destination name to be used on send/receive operations that do not have a destination parameter. |
void |
setDeliveryMode(int deliveryMode)
Set the delivery mode to use when sending a message. |
void |
setDeliveryPersistent(boolean deliveryPersistent)
Set whether message delivery should be persistent or non-persistent, specified as boolean value ("true" or "false"). |
void |
setExplicitQosEnabled(boolean explicitQosEnabled)
Set if the QOS values (deliveryMode, priority, timeToLive) should be used for sending a message. |
void |
setMessageConverter(MessageConverter messageConverter)
Set the message converter for this template. |
void |
setMessageIdEnabled(boolean messageIdEnabled)
Set whether message IDs are enabled. |
void |
setMessageTimestampEnabled(boolean messageTimestampEnabled)
Set whether message timestamps are enabled. |
void |
setPriority(int priority)
Set the priority of a message when sending. |
void |
setPubSubNoLocal(boolean pubSubNoLocal)
Set whether to inhibit the delivery of messages published by its own connection. |
void |
setReceiveTimeout(long receiveTimeout)
Set the timeout to use for receive calls (in milliseconds). |
void |
setTimeToLive(long timeToLive)
Set the time-to-live of the message when sending. |
| Methods inherited from class org.springframework.jms.support.destination.JmsDestinationAccessor |
|---|
getDestinationResolver, isPubSubDomain, resolveDestinationName, setDestinationResolver, setPubSubDomain |
| Methods inherited from class org.springframework.jms.support.JmsAccessor |
|---|
afterPropertiesSet, convertJmsAccessException, createConnection, createSession, getConnectionFactory, getSessionAcknowledgeMode, isClientAcknowledge, isSessionTransacted, setConnectionFactory, setSessionAcknowledgeMode, setSessionAcknowledgeModeName, setSessionTransacted |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long RECEIVE_TIMEOUT_NO_WAIT
public static final long RECEIVE_TIMEOUT_INDEFINITE_WAIT
| Constructor Detail |
|---|
public JmsTemplate()
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 JmsTemplate(ConnectionFactory connectionFactory)
connectionFactory - the ConnectionFactory to obtain Connections from| Method Detail |
|---|
protected void initDefaultStrategies()
JmsDestinationAccessor.setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver),
setMessageConverter(org.springframework.jms.support.converter.MessageConverter),
DynamicDestinationResolver,
SimpleMessageConverterpublic void setDefaultDestination(Destination destination)
Alternatively, specify a "defaultDestinationName", to be dynamically resolved via the DestinationResolver.
send(MessageCreator),
convertAndSend(Object),
convertAndSend(Object, MessagePostProcessor),
setDefaultDestinationName(String)public Destination getDefaultDestination()
public void setDefaultDestinationName(String destinationName)
Alternatively, specify a JMS Destination object as "defaultDestination".
send(MessageCreator),
convertAndSend(Object),
convertAndSend(Object, MessagePostProcessor),
JmsDestinationAccessor.setDestinationResolver(org.springframework.jms.support.destination.DestinationResolver),
setDefaultDestination(javax.jms.Destination)public String getDefaultDestinationName()
public void setMessageConverter(MessageConverter messageConverter)
The default converter is a SimpleMessageConverter, which is able to handle BytesMessages, TextMessages and ObjectMessages.
convertAndSend(java.lang.Object),
receiveAndConvert(),
SimpleMessageConverterpublic MessageConverter getMessageConverter()
public void setMessageIdEnabled(boolean messageIdEnabled)
This is only a hint to the JMS producer. See the JMS javadocs for details.
MessageProducer.setDisableMessageID(boolean)public boolean isMessageIdEnabled()
public void setMessageTimestampEnabled(boolean messageTimestampEnabled)
This is only a hint to the JMS producer. See the JMS javadocs for details.
MessageProducer.setDisableMessageTimestamp(boolean)public boolean isMessageTimestampEnabled()
public void setPubSubNoLocal(boolean pubSubNoLocal)
TopicSession.createSubscriber(javax.jms.Topic, String, boolean)public boolean isPubSubNoLocal()
public void setReceiveTimeout(long receiveTimeout)
The default is RECEIVE_TIMEOUT_INDEFINITE_WAIT, which indicates
a blocking receive without timeout.
Specify RECEIVE_TIMEOUT_NO_WAIT to inidicate that a receive operation
should check if a message is immediately available without blocking.
MessageConsumer.receive(long),
MessageConsumer.receive(),
MessageConsumer.receiveNoWait()public long getReceiveTimeout()
public void setExplicitQosEnabled(boolean explicitQosEnabled)
setDeliveryMode(int),
setPriority(int),
setTimeToLive(long)public boolean isExplicitQosEnabled()
setDeliveryMode(int),
setPriority(int),
setTimeToLive(long)public void setDeliveryPersistent(boolean deliveryPersistent)
Default it "true" aka delivery mode "PERSISTENT".
setDeliveryMode(int),
DeliveryMode.PERSISTENT,
DeliveryMode.NON_PERSISTENTpublic void setDeliveryMode(int deliveryMode)
Since a default value may be defined administratively, this is only used when "isExplicitQosEnabled" equals "true".
deliveryMode - the delivery mode to useisExplicitQosEnabled(),
DeliveryMode.PERSISTENT,
DeliveryMode.NON_PERSISTENT,
Message.DEFAULT_DELIVERY_MODE,
MessageProducer.send(javax.jms.Message, int, int, long)public int getDeliveryMode()
public void setPriority(int priority)
Since a default value may be defined administratively, this is only used when "isExplicitQosEnabled" equals "true".
isExplicitQosEnabled(),
Message.DEFAULT_PRIORITY,
MessageProducer.send(javax.jms.Message, int, int, long)public int getPriority()
public void setTimeToLive(long timeToLive)
Since a default value may be defined administratively, this is only used when "isExplicitQosEnabled" equals "true".
timeToLive - the message's lifetime (in milliseconds)isExplicitQosEnabled(),
Message.DEFAULT_TIME_TO_LIVE,
MessageProducer.send(javax.jms.Message, int, int, long)public long getTimeToLive()
public Object execute(SessionCallback action)
throws JmsException
JmsOperationsWhen used with a 1.0.2 provider, you may need to downcast to the appropriate domain implementation, either QueueSession or TopicSession in the action objects doInJms callback method.
execute in interface JmsOperationsaction - callback object that exposes the session
JmsException - if there is any problem
public Object execute(SessionCallback action,
boolean startConnection)
throws JmsException
execute(SessionCallback),
allowing the JMS Connection to be started on the fly.
Use execute(SessionCallback) for the general case.
Starting the JMS Connection is just necessary for receiving messages,
which is preferably achieved through the receive methods.
action - callback object that exposes the SessionstartConnection - whether to start the Connection
JmsException - if there is any problemexecute(SessionCallback),
receive()
public Object execute(ProducerCallback action)
throws JmsException
JmsOperations
execute in interface JmsOperationsaction - callback object that exposes the session/producer pair
JmsException - checked JMSException converted to unchecked
public Object execute(Destination destination,
ProducerCallback action)
throws JmsException
JmsOperations
execute in interface JmsOperationsdestination - the destination to send messages toaction - callback object that exposes the session/producer pair
JmsException - checked JMSException converted to unchecked
public Object execute(String destinationName,
ProducerCallback action)
throws JmsException
JmsOperations
execute in interface JmsOperationsdestinationName - the name of the destination to send messages to
(to be resolved to an actual destination by a DestinationResolver)action - callback object that exposes the session/producer pair
JmsException - checked JMSException converted to unchecked
public void send(MessageCreator messageCreator)
throws JmsException
JmsOperationsThis will only work with a default destination specified!
send in interface JmsOperationsmessageCreator - callback to create a message
JmsException - checked JMSException converted to unchecked
public void send(Destination destination,
MessageCreator messageCreator)
throws JmsException
JmsOperations
send in interface JmsOperationsdestination - the destination to send this message tomessageCreator - callback to create a message
JmsException - checked JMSException converted to unchecked
public void send(String destinationName,
MessageCreator messageCreator)
throws JmsException
JmsOperations
send in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)messageCreator - callback to create a message
JmsException - checked JMSException converted to unchecked
protected void doSend(Session session,
Destination destination,
MessageCreator messageCreator)
throws JMSException
session - the JMS Session to operate ondestination - the JMS Destination to send tomessageCreator - callback to create a JMS Message
JMSException - if thrown by JMS API methods
protected void doSend(MessageProducer producer,
Message message)
throws JMSException
producer - the JMS MessageProducer to send withmessage - the JMS Message to send
JMSException - if thrown by JMS API methods
public void convertAndSend(Object message)
throws JmsException
JmsOperationsThis will only work with a default destination specified!
convertAndSend in interface JmsOperationsmessage - the object to convert to a message
JmsException - converted checked JMSException to unchecked
public void convertAndSend(Destination destination,
Object message)
throws JmsException
JmsOperations
convertAndSend in interface JmsOperationsdestination - the destination to send this message tomessage - the object to convert to a message
JmsException - converted checked JMSException to unchecked
public void convertAndSend(String destinationName,
Object message)
throws JmsException
JmsOperations
convertAndSend in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)message - the object to convert to a message
JmsException - checked JMSException converted to unchecked
public void convertAndSend(Object message,
MessagePostProcessor postProcessor)
throws JmsException
JmsOperationsThis will only work with a default destination specified!
convertAndSend in interface JmsOperationsmessage - the object to convert to a messagepostProcessor - the callback to modify the message
JmsException - checked JMSException converted to unchecked
public void convertAndSend(Destination destination,
Object message,
MessagePostProcessor postProcessor)
throws JmsException
JmsOperations
convertAndSend in interface JmsOperationsdestination - the destination to send this message tomessage - the object to convert to a messagepostProcessor - the callback to modify the message
JmsException - checked JMSException converted to unchecked
public void convertAndSend(String destinationName,
Object message,
MessagePostProcessor postProcessor)
throws JmsException
JmsOperations
convertAndSend in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)message - the object to convert to a message.postProcessor - the callback to modify the message
JmsException - checked JMSException converted to unchecked
public Message receive()
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
This will only work with a default destination specified!
receive in interface JmsOperationsnull if the timeout expires
JmsException - checked JMSException converted to unchecked
public Message receive(Destination destination)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receive in interface JmsOperationsdestination - the destination to receive a message from
null if the timeout expires
JmsException - checked JMSException converted to unchecked
public Message receive(String destinationName)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receive in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)
null if the timeout expires
JmsException - checked JMSException converted to unchecked
public Message receiveSelected(String messageSelector)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
This will only work with a default destination specified!
receiveSelected in interface JmsOperationsmessageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.
null if the timeout expires
JmsException - checked JMSException converted to unchecked
public Message receiveSelected(Destination destination,
String messageSelector)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receiveSelected in interface JmsOperationsdestination - the destination to receive a message frommessageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.
null if the timeout expires
JmsException - checked JMSException converted to unchecked
public Message receiveSelected(String destinationName,
String messageSelector)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receiveSelected in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)messageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.
null if the timeout expires
JmsException - checked JMSException converted to unchecked
protected Message doReceive(Session session,
Destination destination,
String messageSelector)
throws JMSException
session - the JMS Session to operate ondestination - the JMS Destination to receive frommessageSelector - the message selector for this consumer (can be null)
null if none
JMSException - if thrown by JMS API methods
protected Message doReceive(Session session,
MessageConsumer consumer)
throws JMSException
session - the JMS Session to operate onconsumer - the JMS MessageConsumer to send with
null if none
JMSException - if thrown by JMS API methods
public Object receiveAndConvert()
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
This will only work with a default destination specified!
receiveAndConvert in interface JmsOperationsnull if the timeout expires.
JmsException - checked JMSException converted to unchecked
public Object receiveAndConvert(Destination destination)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receiveAndConvert in interface JmsOperationsdestination - the destination to receive a message from
null if the timeout expires.
JmsException - checked JMSException converted to unchecked
public Object receiveAndConvert(String destinationName)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receiveAndConvert in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)
null if the timeout expires.
JmsException - checked JMSException converted to unchecked
public Object receiveSelectedAndConvert(String messageSelector)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
This will only work with a default destination specified!
receiveSelectedAndConvert in interface JmsOperationsmessageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.
null if the timeout expires.
JmsException - checked JMSException converted to unchecked
public Object receiveSelectedAndConvert(Destination destination,
String messageSelector)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receiveSelectedAndConvert in interface JmsOperationsdestination - the destination to receive a message frommessageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.
null if the timeout expires.
JmsException - checked JMSException converted to unchecked
public Object receiveSelectedAndConvert(String destinationName,
String messageSelector)
throws JmsException
JmsOperationsThis method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.
receiveSelectedAndConvert in interface JmsOperationsdestinationName - the name of the destination to send this message to
(to be resolved to an actual destination by a DestinationResolver)messageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.
null if the timeout expires.
JmsException - checked JMSException converted to uncheckedprotected Object doConvertFromMessage(Message message)
message - the JMS Message to convert (can be null)
null if none
public Object browse(BrowserCallback action)
throws JmsException
JmsOperations
browse in interface JmsOperationsaction - callback object that exposes the session/browser pair
JmsException - checked JMSException converted to unchecked
public Object browse(Queue queue,
BrowserCallback action)
throws JmsException
JmsOperations
browse in interface JmsOperationsqueue - the queue to browseaction - callback object that exposes the session/browser pair
JmsException - checked JMSException converted to unchecked
public Object browse(String queueName,
BrowserCallback action)
throws JmsException
JmsOperations
browse in interface JmsOperationsqueueName - the name of the queue to browse
(to be resolved to an actual destination by a DestinationResolver)action - callback object that exposes the session/browser pair
JmsException - checked JMSException converted to unchecked
public Object browseSelected(String messageSelector,
BrowserCallback action)
throws JmsException
JmsOperations
browseSelected in interface JmsOperationsmessageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.action - callback object that exposes the session/browser pair
JmsException - checked JMSException converted to unchecked
public Object browseSelected(Queue queue,
String messageSelector,
BrowserCallback action)
throws JmsException
JmsOperations
browseSelected in interface JmsOperationsqueue - the queue to browsemessageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.action - callback object that exposes the session/browser pair
JmsException - checked JMSException converted to unchecked
public Object browseSelected(String queueName,
String messageSelector,
BrowserCallback action)
throws JmsException
JmsOperations
browseSelected in interface JmsOperationsqueueName - the name of the queue to browse
(to be resolved to an actual destination by a DestinationResolver)messageSelector - the JMS message selector expression (or null if none).
See the JMS specification for a detailed definition of selector expressions.action - callback object that exposes the session/browser pair
JmsException - checked JMSException converted to uncheckedprotected Connection getConnection(JmsResourceHolder holder)
This implementation accepts any JMS 1.1 Connection.
holder - the JmsResourceHolder
null if none foundprotected Session getSession(JmsResourceHolder holder)
This implementation accepts any JMS 1.1 Session.
holder - the JmsResourceHolder
null if none foundprotected boolean isSessionLocallyTransacted(Session session)
Note: The Session's own transacted flag will already have been checked before. This method is about finding out whether the Session's transaction is local or externally coordinated.
session - the Session to check
JmsAccessor.isSessionTransacted(),
ConnectionFactoryUtils.isSessionTransactional(javax.jms.Session, javax.jms.ConnectionFactory)
protected MessageProducer createProducer(Session session,
Destination destination)
throws JMSException
Delegates to 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.
session - the JMS Session to create a MessageProducer fordestination - the JMS Destination to create a MessageProducer for
JMSException - if thrown by JMS API methodssetMessageIdEnabled(boolean),
setMessageTimestampEnabled(boolean)
protected MessageProducer doCreateProducer(Session session,
Destination destination)
throws JMSException
This implementation uses JMS 1.1 API.
session - the JMS Session to create a MessageProducer fordestination - the JMS Destination to create a MessageProducer for
JMSException - if thrown by JMS API methods
protected MessageConsumer createConsumer(Session session,
Destination destination,
String messageSelector)
throws JMSException
This implementation uses JMS 1.1 API.
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 methods
protected QueueBrowser createBrowser(Session session,
Queue queue,
String messageSelector)
throws JMSException
Delegates to 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.
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 methodssetMessageIdEnabled(boolean),
setMessageTimestampEnabled(boolean)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||