java_enthu
java_enthu

Reputation: 2337

Blocking competing clients to take message from ActiveMQ

We have a JMS queue and multiple competing clients are reading from this queue. Once the message is taken and successfully processed, we want to send the acknowledge to delete ( i.e. CLIENT ACKNOWLEDGE ) However, we want to make sure that if one client has picked the message another client should not take it from the queue. Does activeMQ provide this feature out of the box using some configuration ?

Moreover: If the message processing failed after picking the message, so it could not be acknowledged back, in this scenario we should like other client thread to pickup the message. Is it possible out of the box with configuration , may be specifying timeout values ?

Regards, JE

Upvotes: 1

Views: 152

Answers (1)

Tim Bish
Tim Bish

Reputation: 18376

You need to take some time to understand the difference between a Topic and a Qeueue in order to understand why the first question is not an issue.

For the second question it depends a bit on the ACK mode you are using and how you are processing messages sync or async. Normally for processing where you want to control redeliveries you would do the work inside of a transaction and if the processing fails the message would be redelivered when the TX is rolled back. ActiveMQ supports redelivery policies both client side and broker side that control how many time a message will be redelivered before sent to a DLQ.

Upvotes: 1

Related Questions