Both messages that are sent and messages that are received can be acknowledged.
In the case of message producers, if you want the broker to acknowledge its having received a non-persistent message (to its physical destination), you must set the connection’s MQ_ACK_ON_PRODUCE_PROPERTY to MQ_TRUE. If you do so, the sending function will return only after the broker has acknowledged receipt of the message. By default, the broker acknowledges receipt of persistent messages.
Acknowledgements on the consuming side means that the client runtime acknowledges delivery and consumption of all messages from a physical destination before the message service deletes the message from that destination. You can specify one of the following acknowledge modes for the consuming session when you create that session.
MQ_AUTO_ACKNOWLEDGE specifies that the session automatically acknowledge each message consumed by the client.
MQ_CLIENT_ACKNOWLEDGE specifies that the client must explicitly acknowledge messages by calling MQAcknowledgeMessages. In this case, all messages are acknowledged that have been consumed up to the point where the acknowledge function is called. (This could include messages consumed asynchronously by many different message listeners in that session, independent of the order in which they were consumed.)
MQ_DUPS_OK_ACKNOWLEDGE specifies that the session acknowledges receipt of messages after each ten messages are consumed. It does not guarantee that messages are delivered and consumed only once.
(The setting of the connection property MQ_ACK_ON_ACKNOWLEDGE_PROPERTY also determines the effect of some of these acknowledge modes. For more information, see Table 4–2.)
In the DUPS_OK_ACKNOWLEDGE mode, the session does not wait for broker acknowledgements. This option can be used in Message Queue C clients for which duplicate messages are not a problem. Also, you can call the MQRecoverSession() function to explicitly request redelivery of messages that have been received but not yet acknowledged by the client. When redelivering such messages, the broker will set the header field MQ_REDLIEVERED_HEADER_PROPERTY .