Styles of messaging in applications
Applications can use point-to-point and publish/subscribe messaging.
Messaging styles include...
- one-way
- request and response
- one-way and forward
Applications can use the following styles of asynchronous messaging:
- Point-to-Point
- Use queues to pass messages between each other. The applications are called point-to-point, because a client sends a message to a specific queue and the message is picked up and processed by a server listening to that queue. It is common for a client to have all its messages delivered to one queue. Like any generic mailbox, a queue can contain a mixture of messages of different types.
- Publish/subscribe
- Provide named collection points for messages, called topics. To send messages, applications publish messages to topics. To receive messages, applications subscribe to topics; when a message is published to a topic, it is automatically sent to all the applications that are subscribers of that topic. By using a topic as an intermediary, message publishers are kept independent of subscribers.
Both styles of messaging can be used in the same application.
Applications can use asynchronous messaging in the following ways:
- One-way
- An application sends a message, and does not want a response. This pattern of use is often referred to as a datagram.
- Request and response
- An application sends a request to another application and expects to receive a response in return.
- One-way and forward
- An application sends a request to another application, which sends a message to yet another application.
These messaging techniques can be combined to produce a variety of asynchronous messaging scenarios.
See:
- JMS interfaces - explicit polling for messages
- Message-driven beans - automatic message retrieval
- Sun's JMS spec documentation
- Sun's Enterprise Java Beans specification Sun's J2EE Connector Architecture spec
 
Related concepts
Introduction: Messaging resources