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.
Created Mar 6, 2001
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 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.