Message polling

Message polling uses the mqeQueueManager_waitForMessage() function. This command issues a mqeQueueManager_getMessage() command to the remote queue at regular intervals. As soon as a message that matches the supplied filter becomes available, it is returned to the calling application.

A wait for message call typically looks like this:

rc = mqeQueueManager_waitForMessage(hQueueManger, pExceptBlock, &hMQeMessage, 
                                    hQMgrName, hQueueName, hFilter, 
                                    hAttribute, confirmID, 6000);

The mqeQueueManager_waitForMessage() function polls the remote queue for the length of time specified in its final parameter. The time is specified in milliseconds, so in the example above, the polling lasts for 6 seconds. The thread on which the command is executing is blocked for this length of time, unless a message is returned earlier.

Message polling works on both local and remote queues.

Note:
Use of this technique results in multiple requests being sent over the network.


© IBM Corporation 2000, 2003. All Rights Reserved