Red Hat DocumentationFuse Message BrokerToggle FramesPrintFeedback

JMS Basics

JMS components

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

JMS broker

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

Messages

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

Destinations

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

Queues

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.

Figure 4. Point-to-point Messaging

A sender and three receivers on a queue. Only one receiver gets each message.

Topics

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.

Figure 5. Publish-Subscribe Messaging

A publisher and three subscribers on a topic. Each of the subscribers gets a copy of each message. multiple subscribers

JMS Clients

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

Producer

Producers create messages and send or publish them to the broker for delivery to a specified destination.

Consumer

Consumers retrieve messages from a destination.

Connections

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

Sessions

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.

Comments powered by Disqus