Spring provides a JMS integration framework that simplifies the use of the JMS API and shields the user from differences between the JMS 1.0.2 and 1.1 APIs.
JMS can be roughly divided into two areas of functionality, namely the
production and consumption of messages. The
class is used for message production and synchronous message reception. For
asynchronous reception similar to J2EE's message-driven bean style, Spring
provides a number of message listener containers that are used to create
Message-Driven POJOs (MDPs).
the core functionality for using JMS. It contains JMS template classes
that simplifies the use of the JMS by handling the creation and release of
resources, much like the
JdbcTemplate does for
JDBC. The design principle common to Spring template classes is to provide
helper methods to perform common operations and for more sophisticated
usage, delegate the essence of the processing task to user implemented
callback interfaces. The JMS template follows the same design. The classes
offer various convenience methods for the sending of messages, consuming a
message synchronously, and exposing the JMS session and message producer
to the user.
provides JMSException translation functionality. The translation converts
JMSException hierarchy to a mirrored
hierarchy of unchecked exceptions. If there are any provider specific
subclasses of the checked
this exception is wrapped in the unchecked
org.springframework.jms.support.converter provides a
MessageConverter abstraction to convert between Java objects
and JMS messages.
various strategies for managing JMS destinations, such as providing a
service locator for destinations stored in JNDI.
Finally, the package
org.springframework.jms.connection provides an
implementation of the
for use in standalone applications. It also contains an implementation of
JMS (the cunningly named
This allows for seamless integration of JMS as a transactional resource into
Spring's transaction management mechanisms.