JMS Architecture

JMS is a standard Application Programming Interface (API) for accessing enterprise messaging systems. JMS enables the Java applications that share a messaging system to exchange messages. It also simplifies application development by providing a standard interface for creating, sending, and receiving messages.

JNDI is used to create an initial context to a JMS connection factory, which is used to create connections to JMS-based service providers. In a JMS connection, a particular session context can be retrieved to create message producers and message consumers.

The graphic shows that you can use a message producer to send a message to a destination. To send a message, first create a connection factory to establish a connection with the JMS server. A ConnectionFactory object encapsulates connection configuration information and enables JMS applications to create connections. When the connection is established, a session that enables the message producer to send the message to the destination (topic or queue) is invoked. The target destination then forwards the message to a message consumer.