2

Say I load messages in a queue from multiple nodes.

Then, one or many nodes are pulling messages from the queue.

Is it possible (or is this normal usage?) that the queue guarantees to not hand out a message to more than one server/node?

And does that server/node have to tell the queue it has completed the operation and the queue and delete the message?

1
  • 1
    The answer to all of the above is "yes". If you need a more specific answer, can you ask a more specific question? Commented Jan 1, 2010 at 15:04

3 Answers 3

2

A message queuing system that did not guarantee to hand out a given message to just one recipient would not be worth the using. Some message queue systems have transactional controls. In that case, if a message is collected by one receiver as part of a transaction, but the receiver does not then commit the transaction (and the message queue can identify that the original recipient is no longer available), then it would be reissued. However, the message would not be made available to two processes concurrently.

Sign up to request clarification or add additional context in comments.

Comments

2

What messaging/queuing technology are you using ? AMQP can certainly guarantee this behaviour (amongst many others, including pub/sub models)

Comments

0

If you want this in Java - then a JMS compliant messaging system will do what you want - and most messaging systems have a JMS client. You can Use Spring's JmsTemplate for real ease of use too.

With JMS - a message from a Queue will only be consumed by one and only one client - and once it is consumed (acknowledged) - it will be removed from the messaging system. Also when you publish a message using JMS - if its persistent - it will be sent synchronously, and the send() method won't return until the message is stored on the broker's disk - this is important - if you don't want to run the risk of loosing messages in the event of failure.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.