Getting messages from a queue
We can get messages from a queue in two ways:
- We can remove a message from the queue so that other programs can no longer see it.
- We can copy a message, leaving the original message on the queue. This is known as browsing. We can remove the message once you have browsed it.
In both cases, you use the MQGET call, but first your application must be connected to the queue manager, and use the MQOPEN call to open the queue (for input, browse, or both). These operations are described in Connecting to and disconnecting from a queue manager and Opening and closing objects.
When you have opened the queue, we can use the MQGET call repeatedly to browse or remove messages on the same queue. Call MQCLOSE when you have finished getting all the messages that you want from the queue.
This chapter introduces getting messages from a queue, under these headings:
- Getting messages from a queue using the MQGET call
- The order in which messages are retrieved from a queue
- Getting a particular message
- Type of index
- Handling messages greater than 4 MB long
- Waiting for messages
- Signaling
- Skipping backout
- Application data conversion
- Browsing messages on a queue
- Browsing messages in logical order
- Some cases where the MQGET call fails
- Getting messages from a queue using the MQGET call
- The order in which messages are retrieved from a queue
- Getting a particular message
Parent topic:
Writing a WebSphere MQ application
fg12540_