简体   繁体   中英

Message Receive From Active MQ queue

I had Active MQ Connection Factory get the Connection, get the Session and create receiver from the Queue. I did the Client_Acknowledge here while creating Session. When I got the message in the Queue I receive the message but I did not ack. Noted here and also did not close the connection.

Again in the same connection I tried to receive the same Message. But this time I did not receive message and get null value.

My question is, can I receive the same message twice in the same connection from Active Mq when it's a synchronous call?

This is not possible, the message is held by the first consumer that has not ack'd and not been closed. If you want another consumer to fetch the message than you need to close the consumer or use a transaction and do a rollback to indicate you don't want the message (you would need to configure the redelivery count policy if you don't want retries to the original consumer though).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM