views:

34

answers:

1

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

A: 

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

bsnyder