开发者

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

开发者 https://www.devze.com 2023-01-17 10:25 出处:网络
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 b

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 t开发者_如何学编程he 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


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

0

精彩评论

暂无评论...
验证码 换一张
取 消