Spring helper class that simplifies synchronous JMS access code
Spring provides a JMS integration framework that simplifies the use of the JMS API much like Spring's integration does for the JDBC API.
JMS can be roughly divided into two areas of functionality, namely the production and consumption of messages. The JmsTemplate
class is used for message production and synchronous message reception.
The JmsTemplate
class is the central class in the JMS core package. It simplifies the use of JMS since it handles the creation and release of resources when sending or synchronously receiving messages.
Code that uses the JmsTemplate
only needs to implement callback interfaces giving them a clearly defined high level contract. The MessageCreator
callback interface creates a message given a Session
provided by the calling code in JmsTemplate
. In order to allow for more complex usage of the JMS API, the callback SessionCallback
provides the user with the JMS session and the callback ProducerCallback
exposes a Session
and MessageProducer
pair.