Sun GlassFish Message Queue 4.4 Developer's Guide for C Clients

Parameters

consumerHandle

The handle to the message consumer. This handle is passed back to you when you create a synchronous message consumer.

messageHandle

Output parameter for the handle to the message to be received. You are responsible for freeing the message handle when you are done by calling the MQFreeMessage() function.

This function can only be called if the session is created with receive mode MQ_SESSION_SYNC_RECEIVE. The MQReceiveMessageWait function passes a handle back to you in the messageHandle parameter if there is a message arrived for the consumer specified by the consumerHandle parameter. If there is no message for the consumer, the function blocks until a message is delivered.

When you create a session, you specify one of several acknowledge modes for that session; these are described in Acknowledge Modes. If you specify MQ_CLIENT_ACKNOWLEDGE as the acknowledge mode for the session, you must explicitly call the MQAcknowledgeMessages function to acknowledge messages that you have received. For more information, see the description of the function MQAcknowledgeMessages().

You can use the MQReceiveMessageNoWait() function instead if you do not want to block while waiting for a message to arrive. You can use the function MQReceiveMessageWithTimeout() to wait for a specified time for a message to arrive.