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


The MQAcknowledgeMessages function acknowledges the specified message and all messages received before it on the same session. This function is valid only if the session is created with acknowledge mode set to MQ_CLIENT_ACKNOWLEDGE .

MQAcknowledgeMessages  (const MQSessionHandle  sessionHandle,
                              const MQMessageHandle messageHandle);

Return Value

MQStatus. See the MQStatusIsError() function for more information.



The handle to the session for the consumer that received the specified message.


A handle to the message that you want to acknowledge. This handle is passed back to you when you receive the message (either by calling one of the receive functions or when a message is delivered to your message listener function.)

Whether you receive messages synchronously or asynchronously, you can call the MQAcknowledgeMessages function to acknowledge receipt of the specified message and of all messages that preceded it.

When you create a session you specify one of several acknowledge modes for that session; these are described in Table 4–3. If you specify MQ_CLIENT_ACKNOWLEDGE as the acknowledge mode for the session, you must explicitly call the MQAcknowledgeMessages function to acknowledge receipt of messages consumed in that session.

By default, the calling thread to the MQAcknowledgeMessages function will be blocked until the broker acknowledges receipt of the acknowledgment for the broker consumed. If, when you created the session’s connection, you specified the property MQ_ACK_ON_ACKNOWLEDGE_PROPERTY to be MQ_FALSE, the calling thread will not wait for the broker to acknowledge the acknowledgement.

Common Errors