Styles of messaging in applications
Applications can use point-to-point and publish/subscribe messaging. These styles of messaging can be used in the following ways: one-way; request and response; one-way and forward.
Applications can use the following styles of asynchronous messaging:
Both styles of messaging can be used in the same application.
- Point-to-point
- Point-to-point applications typically use queues to pass messages between each other. An application sends a message to another application by identifying, implicitly or explicitly, a destination queue. The underlying messaging and queuing system receives the message from the sending application and routes the message to its destination queue. The receiving application can then retrieve the message from the queue.
- Publish/subscribe
- In publish/subscribe messaging, there are two types of application: publisher and subscriber.
A publisher supplies information in the form of messages. When a publisher publishes a message, it specifies a topic, which identifies the subject of the information inside the message.
A subscriber is a consumer of the information that is published. A subscriber specifies the topics it is interested in by sending subscription requests to a publish/subscribe broker. The broker receives published messages from publishers and subscription requests from subscribers, and it routes published messages to subscribers. A subscriber receives messages on only those topics to which it has subscribed.
Applications can use asynchronous messaging in the following ways:
- One-way
- An application sends a message, and does not want a response. A message like this can be referred to as a datagram.
- One-way and forward
- An application sends a request to another application, which sends a message to yet another application.
- Request and response
- An application sends a request to another application and expects to receive a response in return.
A typical JMS messaging pattern involves a requesting application sending a message to a JMS queue for processing by a messaging service (for example, a message-driven bean). When the requesting application sends the request message, the message identifies another JMS queue to which the service should send a reply message. After sending the request message, the requesting application either waits for the reply message to arrive, or it reconnects later to retrieve the reply message.
These messaging techniques can be combined to produce a variety of asynchronous messaging scenarios.
For details of how WebSphere applications can use JMS and message-driven beans for asynchronous messaging, see the following topics:
For more information about these messaging techniques and the Java Message Service (JMS), see Sun's Java Message Service (JMS) specification documentation (http://developer.java.sun.com/developer/technicalArticles/Networking/messaging/).
For more information about message-driven bean and inbound messaging support, see Sun's Enterprise JavaBeans specification (http://java.sun.com/products/ejb/docs.html).
For information about JCA inbound messaging processing, see Sun's J2EE Connector Architecture specification (http://java.sun.com/j2ee/connector/download.html).