Ack understanding

Hi I need clarification for the following section of the Messaging documentation.

IMessage<Hello> msgCopy = mqClient.Get<Hello>(QueueNames<Hello>.Out);
mqClient.Ack(msgCopy);
msgCopy.GetBody().Name //= World

Also shown in this example is an explicit Ack (which should be done for each message you receive) to tell the MQ Broker that you’ve taken responsibility of the message so it can safely remove it off the queue.

Regarding the statement mqClient.Ack(msgCopy), is this used in this scenario because it is manually retrieving the message from the queue? And if the message on the queue was handled by a MQService does a similar function similar to Ack performed?

Most MQ brokers support consumer acknowledgements which clients use to tell the broker they’ve successfully received and accepted responsibility for the message. If the message wasn’t acknowledged and the client connection dies the message is not have considered to be consumed and will be resent to another client consuming messages from the MQ. Note some MQ brokers like Redis MQ or In Memory MQ’s don’t support explicit Acks are are NOOP’s, but you should still include them so your code is portable between different brokers.

Yes the MQ Server explicitly acknowledges messages it consumes.