LibraryLink ToToggle FramesPrintFeedback

JMS Basics

Java Message Service (JMS) is a Java Message Oriented Middleware (MOM) API for sending messages between two or more clients. A JMS Provider is the software that implements the Java Message Service (JMS) specification for a messaging product's brokers and clients.

If you are unfamiliar with JMS, you may want to read the Java Message Service API section of Sun Microsystems' J2EE 1.4 Tutorial

A JMS messaging product is comprised of the following components:

  • Brokers

  • Messages

  • Destinations

  • Clients

  • Connections

  • Sessions

A JMS broker provides clients with connectivity, and message storage/delivery functions.

A messages is an object that contains the required heading fields, optional properties, and data payload being transferred between JMS clients.

Destinations are maintained by the message broker. They can be either queues or topics.

A queue is a destination that contains messages sent from a producer that await delivery to one consumer. Messages are delivered in the order sent. A message is removed from the queue once it has been acknowledged as received by the consumer.

In this one-to-one messaging model, producers are senders and consumers are receivers.


Topics are used to send messages to one or more consumers. Producers publish messages to a topic and one or more consumers subscribe to the topic

In this one-to-many messaging scenario, producers are also referred to as publishers and consumers as subscribers.


A JMS client is an application that uses the services of the message broker. There are two client types in a JMS system:

Connections are the technique used by clients to specify a protocol and credentials for a sustained client interaction with a broker.

Sessions are defined by a client on a conection established with a broker. Each session defines whether the messages will form transactions, and -- if not -- the acknowledgement mode for messages.