Luke101
Luke101

Reputation: 65266

Is it possible to dequeue and queue in same transaction

I have a message a want to dequeue then right after its dequeued I want to queue another message to a different queue. I want to do all this in the same transaction. is this possible with rabbitmq or any other queueing service?

Upvotes: 0

Views: 145

Answers (1)

Alex Buyny
Alex Buyny

Reputation: 3185

The closest you can get to what you want with RabbitMQ is:

Use acks and publisher confirms

  • You receive a message and do not ack it.
  • Send your reply message.
  • Wait for confirm from the broker.
  • Once confirm had arrived, ack initial message.

But then, consider this failure situation:

  • Initial message received

  • Reply message sent

  • Your service failed before ACKing initial message

  • When your service is back, it will receive the initial message again

So you will need to use some deduplication mechanism etc.

Upvotes: 1

Related Questions