Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RabbitMQ Visibility Timeout

Do RabbitMQ queues have a AWS SQS-like - "message visibility timeout" ?

From the AWS SQS documentation :

"The visibility timeout clock starts ticking once Amazon SQS returns the message. During that time, the component processes and deletes the message. But what happens if the component fails before deleting the message? If your system doesn't call DeleteMessage for that message before the visibility timeout expires, the message again becomes visible to the ReceiveMessage calls placed by the components in your system and it will be received again"

Thanks!

like image 689
MadSeb Avatar asked Oct 16 '13 18:10

MadSeb


People also ask

What is visibility timeout?

Visibility timeout is the time-period or duration you specify for the queue item which when is fetched and processed by the consumer is made hidden from the queue and other consumers. The main purpose is to avoid multiple consumers (or the same consumer), consuming the same item repetitively.

What happens after visibility timeout?

During this time, the consumer processes and deletes the message. However, if the consumer fails before deleting the message and your system doesn't call the DeleteMessage action for that message before the visibility timeout expires, the message becomes visible to other consumers and the message is received again.

What is TTL in RabbitMQ?

RabbitMQ allows you to set TTL (time to live) for both messages and queues. This is controlled by optional queue arguments and best done using a policy. Message TTL can be applied to a single queue, a group of queues or applied on the message-by-message basis. TTL settings also can be enforced by operator policies.

What is the default visibility timeout for a message in an SQS queue?

Every SQS queue has the default visibility timeout setting for 30 seconds.


2 Answers

I believe you are looking for the RabbitMQ manual acknowledgment feature. This feature allows you get messages from the queue and once you have receive them ack'ed them. If something happens in the middle of this process, the message will be available again in the queue after a certain amount of time. Also, in the meantime since you get the message until you ack it, the message is not available for other consumers to consume.

I think this is the same behavior as Message Visibility Timeout of SQS.

like image 194
hveiga Avatar answered Oct 23 '22 07:10

hveiga


There aren't any message timeouts; RabbitMQ will redeliver the message only when the worker connection dies. It's fine even if processing a message takes a very, very long time.There aren't any message timeouts; RabbitMQ will redeliver the message only when the worker connection dies. It's fine even if processing a message takes a very, very long time.

like image 33
Giri Chintala Avatar answered Oct 23 '22 06:10

Giri Chintala