Dead letter queue consumption issue
TDliumin opened this issue · 2 comments
Issue
When I consume the data of a dead letter queue named my-app.test.error
, it occurred an error Unexpected error PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'my-app.test.error' in vhost 'stg': received the value 'undefined' of type 'void' but current is none
.
Is this my own setting error ?
My code
queue_name = ‘my-app.test.error'.freeze
routing_key = 'my-app.test'.freeze
WORKER_OPTIONS = {
ack: true,
heartbeat: 10,
routing_key: routing_key,
max_retries: Workers.system[:workers_max_retries],
arguments: {
'x-dead-letter-exchange' => nil,
'x-dead-letter-routing-key' => nil,
},
}.freeze
from_queue queue_name, WORKER_OPTIONS
def perform(job_payload)
params = JSON.parse(job_payload)
end
This seems to be a client-specific behavior where one client does not set the value (likely Sneakers via Bunny) but the client you try to use sets it to "undefined" instead of filtering out such values in argument tables.
Without knowing what client you are trying to consume from, the only suggestion I have is to use a passive declare (that will simply ensure that the queue is there, without a redeclaration and thus the property/argument equivalency check).
Clients usually filter out undefined/null/None values in attribute tables.
@michaelklishin Thank you for your reply. The dead letter queue I'm consuming is generated by the Sneakers framework, and I currently want to consume this queue. No matter what values I set for 'x-dead-letter-exchange' and 'x-dead-letter-routing-key', always occurs an error. My issue is like this issue.
It can work normally when using a similar setting to consume non-dead letter queues and only encounters problems when consuming dead letter queues.
Unexpected error PRECONDITION_FAILED - inequivalent arg 'x-dead-letter-exchange' for queue 'my-app.test.error' in vhost 'stg': received the value '' of type '' but current is none
Could you give me some guidance?