JMS

The Java Message Service (JMS) API is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients.

It is an implementation to handle the Producer-consumer problem in order to create, send, receive, and read messages, It allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.

The JMS API supports two models:

Point-to-point

In the point-to-point messaging system, messages are routed to an individual(only one) consumer which maintains a queue of “incoming” messages until they are consumed or expired.

Publish and subscribe
The publish/subscribe model supports publishing messages to a particular message topic. Subscribers may register interest in receiving messages on a particular message topic from the moment they subscribe onwards. In this model, neither the publisher nor the subscriber knows about each other.