Getting messages from a queue

 

We can get messages from a queue in two ways:

  1. We can remove a message from the queue so that other programs can no longer see it.

  2. 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:

 

Parent topic:

Writing a WebSphere MQ application


fg12540_