[Suggestion] Consider self-routing dead-letters a cycle #15257
-
RabbitMQ series4.2.x Operating system (distribution) usedLinux How is RabbitMQ deployed?Other What would you like to suggest for a future version of RabbitMQ?Currently, if you set up dead-lettering to route to an exchange which routes back to the source queue, you can infinitely 'print' messages with
In the shell, for convenience: > rr(amqp_gen_connection).
> {ok, Conn} = amqp_connection:start(#amqp_params_direct{}), {ok, Ch} = amqp_connection:open_channel(Conn).
% repeat this one:
> (fun() -> {#'basic.get_ok'{delivery_tag = T}, _} = amqp_channel:call(Ch, #'basic.get'{queue = <<"one">>}), amqp_channel:cast(Ch, #'basic.nack'{delivery_tag = T, requeue = false}) end)().With this topology, dead-lettered messages are routed to We already have dead-lettering cycle detection to find loops where messages end up passed between multiple queues and eventually back to the source. Would it make sense to call the route from
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
To me, everything works as expected. The current cycle detection by design only drops messages if the cycle is "fully automatic", i.e. without a client explicitly rejecting the message somewhere in the cycle. The idea is that messages are only dropped if they cycle forever without explicit consumer action. For example if you set up two queues A and B with both queues having message TTL configured and both queues dead lettering to each other, this will result in endless cycles, hence the cycle detection will drop those messages. On the other hand, in your example, if the message cycles from queue That said, I believe your concern is that messages might cycle forever due to unintentional cycles. |
Beta Was this translation helpful? Give feedback.
To me, everything works as expected.
The current cycle detection by design only drops messages if the cycle is "fully automatic", i.e. without a client explicitly rejecting the message somewhere in the cycle. The idea is that messages are only dropped if they cycle forever without explicit consumer action.
For example if you set up two queues A and B with both queues having message TTL configured and both queues dead lettering to each other, this will result in endless cycles, hence the cycle detection will drop those messages.
On the other hand, in your example, if the message cycles from queue
oneimmediately back to queueonedue to a consumer intentionally rejecting the message, that …