Is there a way to to send a message.acknowledge() for each and every message. The message.acknowledge() removes all the messages that have been received by a QueueReceiver.

Doug Erickson

If you want to control message acknowledgment on a per-message basis, you shouldn't consume another message until you've acknowledged the current one. It's impossible to acknowledge a message without acknowledging all previously consumed messages. For example, if you receive messages A, B, and then C, there's no way to acknowledge C without acknowledging A and B as well.

Reconsider what you are trying to achieve. Other design alternatives include message selectors or a dead message queue.

If you don't want to acknowledge earlier messages because they are not relevant to you, don't consume them; use a message selector to get only the messages you care about. If you're using queues, it is important to have another receiver to consume these messages, or eventually the queue will back up.

If you don't want to acknowledge a message because processing failed, but you don't want to stop processing subsequent messages, requeue the bad message in a "dead letter" queue for manual intervention, acknowledge it, and move on to the next.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact