Message queues, and the software that manages them, such as IBM WebSphere MQ for z/OS, enable program-to-program communication.
Messaging means that programs communicate by sending each other messages (data), rather than by calling each other directly.
Queuing means that the messages are placed on queues in storage, so that programs can run independently of each other, at different speeds and times, in different locations, and without having a logical connection between them.
Synchronous Vs Asynchronous message queues working concept to read now
- Program A prepares a message and puts it on Queue 1. Program B gets the message from Queue 1 and processes it. Both Program A and Program B use an application programming interface (API) to put messages on a queue and get messages from a queue. The WebSphere MQ API is called the Message Queue Interface (MQI).
- When Program A puts a message on Queue 1, Program B might not be running. The queue stores the message safely until Program B starts and is ready to get the message. Likewise, at the time Program B gets the message from Queue 1, Program A might no longer be running. Using this model, there is no requirement for two programs communicating with each other to be executing at the same time.
The asynchronous model is natural for WebSphere MQ. Program A can continue to put messages on Queue 1 and is not blocked by having to wait for a reply to each message. It can continue to put messages on Queue 1 even if Program B fails. If so, Queue 1 stores the messages safely until Program B is restarted.
Role of Queue Manager
When an application puts a message on a queue, the queue manager ensures that the message is:
- Stored safely
- Is recoverable
- Is delivered once, and once only, to the receiving application