Top Description Methods
org.springframework.jms.core

public Interface JmsOperations

Known Direct Implementers
org.springframework.jms.core.JmsTemplate
Imports
jakarta.jms.Destination, .Message, .Queue, org.springframework.jms.JmsException, org.springframework.lang.Nullable

Specifies a basic set of JMS operations.

Implemented by JmsTemplate. Not often used but a useful option to enhance testability, as it can easily be mocked or stubbed.

Provides JmsTemplate's send(..) and receive(..) methods that mirror various JMS API methods. See the JMS specification and javadocs for details on those methods.

Provides also basic request reply operation using a temporary queue to collect the reply.

Authors
Mark Pollack, Juergen Hoeller, Stephane Nicoll
Since
1.1
See Also
JmsTemplate, jakarta.jms.Destination, jakarta.jms.Session, jakarta.jms.MessageProducer, jakarta.jms.MessageConsumer

Method Summary

Modifier and TypeMethod and Description
public <T> T

Returns:

the result object from working with the session
browse
(BrowserCallback<T>
callback object that exposes the session/browser pair
action
)

Browse messages in the default JMS queue.

public <T> T

Returns:

the result object from working with the session
browse
(Queue
the queue to browse
queue
,
BrowserCallback<T>
callback object that exposes the session/browser pair
action
)

Browse messages in a JMS queue.

public <T> T

Returns:

the result object from working with the session
browse
(String
the name of the queue to browse (to be resolved to an actual destination by a DestinationResolver)
queueName
,
BrowserCallback<T>
callback object that exposes the session/browser pair
action
)

Browse messages in a JMS queue.

public <T> T

Returns:

the result object from working with the session
browseSelected
(String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
,
BrowserCallback<T>
callback object that exposes the session/browser pair
action
)

Browse selected messages in a JMS queue.

public <T> T

Returns:

the result object from working with the session
browseSelected
(Queue
the queue to browse
queue
,
String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
,
BrowserCallback<T>
callback object that exposes the session/browser pair
action
)

Browse selected messages in a JMS queue.

public <T> T

Returns:

the result object from working with the session
browseSelected
(String
the name of the queue to browse (to be resolved to an actual destination by a DestinationResolver)
queueName
,
String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
,
BrowserCallback<T>
callback object that exposes the session/browser pair
action
)

Browse selected messages in a JMS queue.

public void
convertAndSend(Object
the object to convert to a message
message
)

Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter.

public void
convertAndSend(Destination
the destination to send this message to
destination
,
Object
the object to convert to a message
message
)

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.

public void
convertAndSend(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
Object
the object to convert to a message
message
)

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.

public void
convertAndSend(Object
the object to convert to a message
message
,
MessagePostProcessor
the callback to modify the message
postProcessor
)

Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter.

public void
convertAndSend(Destination
the destination to send this message to
destination
,
Object
the object to convert to a message
message
,
MessagePostProcessor
the callback to modify the message
postProcessor
)

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.

public void
convertAndSend(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
Object
the object to convert to a message.
message
,
MessagePostProcessor
the callback to modify the message
postProcessor
)

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.

public <T> T

Returns:

the result object from working with the session
execute
(SessionCallback<T>
callback object that exposes the session
action
)

Execute the action specified by the given action object within a JMS Session.

public <T> T

Returns:

the result object from working with the session
execute
(ProducerCallback<T>
callback object that exposes the session/producer pair
action
)

Send messages to the default JMS destination (or one specified for each send operation).

public <T> T

Returns:

the result object from working with the session
execute
(Destination
the destination to send messages to
destination
,
ProducerCallback<T>
callback object that exposes the session/producer pair
action
)

Send messages to a JMS destination.

public <T> T

Returns:

the result object from working with the session
execute
(String
the name of the destination to send messages to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
ProducerCallback<T>
callback object that exposes the session/producer pair
action
)

Send messages to a JMS destination.

public Message

Returns:

the message received by the consumer, or null if the timeout expires
receive
()

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.

public Message

Returns:

the message received by the consumer, or null if the timeout expires
receive
(Destination
the destination to receive a message from
destination
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Message

Returns:

the message received by the consumer, or null if the timeout expires
receive
(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Object

Returns:

the message produced for the consumer or null if the timeout expires.
receiveAndConvert
()

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.

public Object

Returns:

the message produced for the consumer or null if the timeout expires.
receiveAndConvert
(Destination
the destination to receive a message from
destination
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Object

Returns:

the message produced for the consumer or null if the timeout expires.
receiveAndConvert
(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Message

Returns:

the message received by the consumer, or null if the timeout expires
receiveSelected
(String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
)

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.

public Message

Returns:

the message received by the consumer, or null if the timeout expires
receiveSelected
(Destination
the destination to receive a message from
destination
,
String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Message

Returns:

the message received by the consumer, or null if the timeout expires
receiveSelected
(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Object

Returns:

the message produced for the consumer or null if the timeout expires.
receiveSelectedAndConvert
(String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
)

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.

public Object

Returns:

the message produced for the consumer or null if the timeout expires.
receiveSelectedAndConvert
(Destination
the destination to receive a message from
destination
,
String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public Object

Returns:

the message produced for the consumer or null if the timeout expires.
receiveSelectedAndConvert
(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
String
the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.
messageSelector
)

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

public void
send(MessageCreator
callback to create a message
messageCreator
)

Send a message to the default destination.

public void
send(Destination
the destination to send this message to
destination
,
MessageCreator
callback to create a message
messageCreator
)

Send a message to the specified destination.

public void
send(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
MessageCreator
callback to create a message
messageCreator
)

Send a message to the specified destination.

public Message

Returns:

the reply, possibly null if the message could not be received, for example due to a timeout
sendAndReceive
(MessageCreator
callback to create a request message
messageCreator
)

Send a request message and receive the reply from a default destination.

public Message

Returns:

the reply, possibly null if the message could not be received, for example due to a timeout
sendAndReceive
(Destination
the destination to send this message to
destination
,
MessageCreator
callback to create a message
messageCreator
)

Send a message and receive the reply from the specified destination.

public Message

Returns:

the reply, possibly null if the message could not be received, for example due to a timeout
sendAndReceive
(String
the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)
destinationName
,
MessageCreator
callback to create a message
messageCreator
)

Send a message and receive the reply from the specified destination.

Method Detail

browseback to summary
public <T> T browse(BrowserCallback<T> action) throws JmsException

Browse messages in the default JMS queue. The callback gives access to the JMS Session and QueueBrowser in order to browse the queue and react to the contents.

Parameters
action:BrowserCallback<T>

callback object that exposes the session/browser pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
browseback to summary
public <T> T browse(Queue queue, BrowserCallback<T> action) throws JmsException

Browse messages in a JMS queue. The callback gives access to the JMS Session and QueueBrowser in order to browse the queue and react to the contents.

Parameters
queue:Queue

the queue to browse

action:BrowserCallback<T>

callback object that exposes the session/browser pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
browseback to summary
public <T> T browse(String queueName, BrowserCallback<T> action) throws JmsException

Browse messages in a JMS queue. The callback gives access to the JMS Session and QueueBrowser in order to browse the queue and react to the contents.

Parameters
queueName:String

the name of the queue to browse (to be resolved to an actual destination by a DestinationResolver)

action:BrowserCallback<T>

callback object that exposes the session/browser pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
browseSelectedback to summary
public <T> T browseSelected(String messageSelector, BrowserCallback<T> action) throws JmsException

Browse selected messages in a JMS queue. The callback gives access to the JMS Session and QueueBrowser in order to browse the queue and react to the contents.

Parameters
messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

action:BrowserCallback<T>

callback object that exposes the session/browser pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
browseSelectedback to summary
public <T> T browseSelected(Queue queue, String messageSelector, BrowserCallback<T> action) throws JmsException

Browse selected messages in a JMS queue. The callback gives access to the JMS Session and QueueBrowser in order to browse the queue and react to the contents.

Parameters
queue:Queue

the queue to browse

messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

action:BrowserCallback<T>

callback object that exposes the session/browser pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
browseSelectedback to summary
public <T> T browseSelected(String queueName, String messageSelector, BrowserCallback<T> action) throws JmsException

Browse selected messages in a JMS queue. The callback gives access to the JMS Session and QueueBrowser in order to browse the queue and react to the contents.

Parameters
queueName:String

the name of the queue to browse (to be resolved to an actual destination by a DestinationResolver)

messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

action:BrowserCallback<T>

callback object that exposes the session/browser pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
convertAndSendback to summary
public void convertAndSend(Object message) throws JmsException

Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter.

This will only work with a default destination specified!

Parameters
message:Object

the object to convert to a message

Exceptions
JmsException:
converted checked JMSException to unchecked
convertAndSendback to summary
public void convertAndSend(Destination destination, Object message) throws JmsException

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.

Parameters
destination:Destination

the destination to send this message to

message:Object

the object to convert to a message

Exceptions
JmsException:
converted checked JMSException to unchecked
convertAndSendback to summary
public void convertAndSend(String destinationName, Object message) throws JmsException

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

message:Object

the object to convert to a message

Exceptions
JmsException:
checked JMSException converted to unchecked
convertAndSendback to summary
public void convertAndSend(Object message, MessagePostProcessor postProcessor) throws JmsException

Send the given object to the default destination, converting the object to a JMS message with a configured MessageConverter. The MessagePostProcessor callback allows for modification of the message after conversion.

This will only work with a default destination specified!

Parameters
message:Object

the object to convert to a message

postProcessor:MessagePostProcessor

the callback to modify the message

Exceptions
JmsException:
checked JMSException converted to unchecked
convertAndSendback to summary
public void convertAndSend(Destination destination, Object message, MessagePostProcessor postProcessor) throws JmsException

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. The MessagePostProcessor callback allows for modification of the message after conversion.

Parameters
destination:Destination

the destination to send this message to

message:Object

the object to convert to a message

postProcessor:MessagePostProcessor

the callback to modify the message

Exceptions
JmsException:
checked JMSException converted to unchecked
convertAndSendback to summary
public void convertAndSend(String destinationName, Object message, MessagePostProcessor postProcessor) throws JmsException

Send the given object to the specified destination, converting the object to a JMS message with a configured MessageConverter. The MessagePostProcessor callback allows for modification of the message after conversion.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

message:Object

the object to convert to a message.

postProcessor:MessagePostProcessor

the callback to modify the message

Exceptions
JmsException:
checked JMSException converted to unchecked
executeback to summary
public <T> T execute(SessionCallback<T> action) throws JmsException

Execute the action specified by the given action object within a JMS Session.

Parameters
action:SessionCallback<T>

callback object that exposes the session

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
if there is any problem
executeback to summary
public <T> T execute(ProducerCallback<T> action) throws JmsException

Send messages to the default JMS destination (or one specified for each send operation). The callback gives access to the JMS Session and MessageProducer in order to perform complex send operations.

Parameters
action:ProducerCallback<T>

callback object that exposes the session/producer pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
executeback to summary
public <T> T execute(Destination destination, ProducerCallback<T> action) throws JmsException

Send messages to a JMS destination. The callback gives access to the JMS Session and MessageProducer in order to perform complex send operations.

Parameters
destination:Destination

the destination to send messages to

action:ProducerCallback<T>

callback object that exposes the session/producer pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
executeback to summary
public <T> T execute(String destinationName, ProducerCallback<T> action) throws JmsException

Send messages to a JMS destination. The callback gives access to the JMS Session and MessageProducer in order to perform complex send operations.

Parameters
destinationName:String

the name of the destination to send messages to (to be resolved to an actual destination by a DestinationResolver)

action:ProducerCallback<T>

callback object that exposes the session/producer pair

Returns:T

the result object from working with the session

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveback to summary
public Message receive() throws JmsException

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.

This 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!

Returns:Message

the message received by the consumer, or null if the timeout expires

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveback to summary
public Message receive(Destination destination) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destination:Destination

the destination to receive a message from

Returns:Message

the message received by the consumer, or null if the timeout expires

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveback to summary
public Message receive(String destinationName) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

Returns:Message

the message received by the consumer, or null if the timeout expires

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveAndConvertback to summary
public Object receiveAndConvert() throws JmsException

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery. Convert the message into an object with a configured MessageConverter.

This 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!

Returns:Object

the message produced for the consumer or null if the timeout expires.

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveAndConvertback to summary
public Object receiveAndConvert(Destination destination) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. Convert the message into an object with a configured MessageConverter.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destination:Destination

the destination to receive a message from

Returns:Object

the message produced for the consumer or null if the timeout expires.

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveAndConvertback to summary
public Object receiveAndConvert(String destinationName) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. Convert the message into an object with a configured MessageConverter.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

Returns:Object

the message produced for the consumer or null if the timeout expires.

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveSelectedback to summary
public Message receiveSelected(String messageSelector) throws JmsException

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery.

This 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!

Parameters
messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

Returns:Message

the message received by the consumer, or null if the timeout expires

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveSelectedback to summary
public Message receiveSelected(Destination destination, String messageSelector) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destination:Destination

the destination to receive a message from

messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

Returns:Message

the message received by the consumer, or null if the timeout expires

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveSelectedback to summary
public Message receiveSelected(String destinationName, String messageSelector) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

Returns:Message

the message received by the consumer, or null if the timeout expires

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveSelectedAndConvertback to summary
public Object receiveSelectedAndConvert(String messageSelector) throws JmsException

Receive a message synchronously from the default destination, but only wait up to a specified time for delivery. Convert the message into an object with a configured MessageConverter.

This 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!

Parameters
messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

Returns:Object

the message produced for the consumer or null if the timeout expires.

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveSelectedAndConvertback to summary
public Object receiveSelectedAndConvert(Destination destination, String messageSelector) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. Convert the message into an object with a configured MessageConverter.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destination:Destination

the destination to receive a message from

messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

Returns:Object

the message produced for the consumer or null if the timeout expires.

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
receiveSelectedAndConvertback to summary
public Object receiveSelectedAndConvert(String destinationName, String messageSelector) throws JmsException

Receive a message synchronously from the specified destination, but only wait up to a specified time for delivery. Convert the message into an object with a configured MessageConverter.

This method should be used carefully, since it will block the thread until the message becomes available or until the timeout value is exceeded.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

messageSelector:String

the JMS message selector expression (or null if none). See the JMS specification for a detailed definition of selector expressions.

Returns:Object

the message produced for the consumer or null if the timeout expires.

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
sendback to summary
public void send(MessageCreator messageCreator) throws JmsException

Send a message to the default destination.

This will only work with a default destination specified!

Parameters
messageCreator:MessageCreator

callback to create a message

Exceptions
JmsException:
checked JMSException converted to unchecked
sendback to summary
public void send(Destination destination, MessageCreator messageCreator) throws JmsException

Send a message to the specified destination. The MessageCreator callback creates the message given a Session.

Parameters
destination:Destination

the destination to send this message to

messageCreator:MessageCreator

callback to create a message

Exceptions
JmsException:
checked JMSException converted to unchecked
sendback to summary
public void send(String destinationName, MessageCreator messageCreator) throws JmsException

Send a message to the specified destination. The MessageCreator callback creates the message given a Session.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

messageCreator:MessageCreator

callback to create a message

Exceptions
JmsException:
checked JMSException converted to unchecked
sendAndReceiveback to summary
public Message sendAndReceive(MessageCreator messageCreator) throws JmsException

Send a request message and receive the reply from a default destination. The MessageCreator callback creates the message given a Session. A temporary queue is created as part of this operation and is set in the JMSReplyTO header of the message.

This will only work with a default destination specified!

Parameters
messageCreator:MessageCreator

callback to create a request message

Returns:Message

the reply, possibly null if the message could not be received, for example due to a timeout

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
Since
4.1
sendAndReceiveback to summary
public Message sendAndReceive(Destination destination, MessageCreator messageCreator) throws JmsException

Send a message and receive the reply from the specified destination. The MessageCreator callback creates the message given a Session. A temporary queue is created as part of this operation and is set in the JMSReplyTO header of the message.

Parameters
destination:Destination

the destination to send this message to

messageCreator:MessageCreator

callback to create a message

Returns:Message

the reply, possibly null if the message could not be received, for example due to a timeout

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
Since
4.1
sendAndReceiveback to summary
public Message sendAndReceive(String destinationName, MessageCreator messageCreator) throws JmsException

Send a message and receive the reply from the specified destination. The MessageCreator callback creates the message given a Session. A temporary queue is created as part of this operation and is set in the JMSReplyTO header of the message.

Parameters
destinationName:String

the name of the destination to send this message to (to be resolved to an actual destination by a DestinationResolver)

messageCreator:MessageCreator

callback to create a message

Returns:Message

the reply, possibly null if the message could not be received, for example due to a timeout

Annotations
@Nullable
Exceptions
JmsException:
checked JMSException converted to unchecked
Since
4.1