Package javax.jms


The Java Message Service provides an API for message-based communications between separate Java processes. Message-based communication is asynchronous in nature: a message is sent out addressed to a recipient or group of recipients, and the recipient receives and acts on the message some unspecified time after that. This is different from other network-based communications between clients, like RMI, where the sender of a message waits for a response from the receiver before continuing.

In the JMS model, clients of a message service send and receive messages through a provider that is responsible for delivering messages. JMS 1.0 provides two models for messaging among clients: point-to-point and publish/subscribe. In point-to-point messaging, a message is created by one client and addressed for a single remote client. The provider is handed the message and delivers it to the one client targeted by the message. This model revolves around message queues; a message sender will queue outgoing messages for delivery, a message recipient will queue incoming messages for handling. The interfaces provided in the javax.jms package for point-to-point messaging have “Queue” as their prefix (QueueConnection, QueueSession, etc.). In publish/subscribe messaging, a hierarchical content tree is established, and clients publish messages to specific nodes or topics in the tree, to be delivered to any clients that have subscribed to these nodes. Interfaces related to publish/subscribe ...

Get Java Enterprise in a Nutshell, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.