Chapter 5. Spring JMS

The Java Messaging Service (JMS) API, which came into existence a decade ago, was an instant hit in the area of distributed messaging and enterprise applications. The demand for easier and standardized integration with the Messaging Middleware was the drive for creating this technology. Although the API is straightforward and relatively easy, Spring has taken a step forward in creating an even easier framework around it. This chapter will introduce you to the JMS basics and explains Spring’s take on JMS and how it simplified developers’ lives even further.

Two-Minute JMS

JMS provides a mechanism of communication between applications without being coupled. The applications can talk to each other via the JMS provider without even knowing who is on the other side of the fence.

For example, a PriceQuote service can publish price quotes onto a channel, expecting someone to receive them. However, the service may not be aware of any consumers that would consume these quotes. Similarly, the consumers may not have any clue about the source of the data or the producers. In a way, they are hidden behind the walls, just interacting via destinations or channels. Producers and consumers don’t have to bother about each other’s existence as long as they know their expected messages are delivered or received, respectively.

There are three important moving pieces in JMS: the service provider, the producer, and the consumer.

The service provider is the central piece, while the other ...

Get Just Spring now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.