danieleteti / delphistompclient

STOMP client for Embarcadero Delphi and FreePascal.
142 stars 65 forks source link

How to ack a message #15

Closed apmarathe closed 8 years ago

apmarathe commented 8 years ago

In our implementation, we observe that when a message response comes back to the Delphi code via the stomp client, the response is not deleted from the response queue.

I have tried something like this to ack the message, thinking that ack-ing a message might remove it from the response queue.

procedure Consumer.OnMessage(StompClient: IStompClient; StompFrame: IStompFrame; var StopListening: Boolean);

<-- code deleted -->

StompClient.Ack(StompFrame.MessageID());

My question is: Is this a correct way to ack a response? If not, could you please share how?

Thanks, Arun

danieleteti commented 8 years ago

Yes, this is the correct way to ACK (or NACK using NACK()) a message. Follows the Tutorials in the tutorial folder to understand this and other best practices.

apmarathe commented 8 years ago

The reason that I asked this question was this. After ACK-ing the message this way, it does not get removed from the queue on the RabbitMQ server (as it should be).

danieleteti commented 8 years ago

Does your client use STOMP 1.1? If so, pull the latest repo version and retry passing the subscriptionid to the ACK method.