An API that provides the facility to create, send and read messages. It provides loosely coupled, reliable and asynchronous communication.
JMS
Asynchronous: To receive the message, client is not required to send request. Message will arrive automatically to the client.
Reliable: It provides assurance that message is delivered.
Messaging is a technique to communicate applications or software components
JMS is mainly used to send and receive message from one application to another
Messaging Domains
Point-to-Point Messaging Domain
Publisher/Subscriber Messaging Domain
Point-to-Point (PTP) Messaging Domain
One message is delivered to one receiver only. Queue is used as a message oriented middleware (MOM) to hold the message until receiver is ready. There is no timing dependency between sender and receiver.
Publisher/Subscriber (Pub/Sub) Messaging Domain
One message is delivered to all the subscribers. Topic is used as a message oriented middleware to hold and deliver messages. There is timing dependency between publisher and subscriber.
ConnectionFactory
An Administered object, used for creating Connections. Implements QueueConnectionFactory and TopicConnectionFactory.
Connection
A client's active connection to its JMS provider. Allocates provider resources outside the Java virtual machine (JVM).
Session
A single-threaded context for producing and consuming messages. With the auto acknowledgment mode, the session automatically acknowledges a client's receipt of a message.
MessageConsumer
A client uses this object to receive messages from a destination. Created by passing a Destination object to a message-consumer creation method supplied by a session.
JMS Point-to-Point Connection
1. Establish connection to ActiveMQ broker
2. Create session
3. Create queue
4. Create message producer
5. Send message
JMS Publish-Subscribe Connection
1. Establish connection to ActiveMQ broker
2. Create session
3. Create topic
4. Create message producer
5. Send message
ActiveMQ is an open source message broker software that implements the Java Message Service (JMS) API
To use ActiveMQ, enter username and password as 'admin'