Sun Java System Message Queue 3.7 UR1 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.

timeoutMilliseconds

The number of milliseconds to wait for a message to arrive.

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 MQReceiveMessageWithTimeout() function passes a handle back to you in the messageHandle parameter if a message arrives for the consumer specified by the consumerHandle parameter in the amount of time specified by the timoutMilliseconds parameter. If no message arrives within the specified amount of time, the function returns an error.

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 MQReceiveMessageWait() function to block while waiting for a message to arrive. You can use the MQReceiveMessageNoWait() function if you do not want to wait for the message to arrive.