Aayush Puri
Aayush Puri

Reputation: 1899

Does an ActiveMQ consumer need to be open when explicit acking messages?

My application does batch processing by reading messages from ActiveMQ. I read using the async JMS API by implementing MessageListener. But I ACK the messages only when the batch processing succeeds by calling message.acknowldge() [1].

What I ideally want is that till the batch processing is going on I do not receive any messages from the JMS broker. But I have doubt as to whether after closing the consumer, I would be able to ACK messages that I read earlier and which are being processed.

In other words, does explicit acknowledgment using message.acknowledge() require that the ActiveMQ consumer be open?

[1] http://download.oracle.com/javaee/5/api/javax/jms/Message.html#acknowledge%28%29

Upvotes: 1

Views: 596

Answers (1)

bsnyder
bsnyder

Reputation: 1199

The consumer does not need to be open, but the session does. (Behind the scenes, it's the Session.sendAck method that does the work.)

Bruce

Upvotes: 0

Related Questions