I'm trying to configure the RabbitMQ I don't know if is possible or if there is a better solution.
I am working with a java client and I want, after a AmqpRejectAndDontRequeueException, the RabbitMQ redirect the message to another queue and wait for some time. After that, the message come again to the first queue and the workflow repeat until one count reach a value and in that moment the message is redirected to a error queue and stay there.
I want this without change in the java code. The java just know about the first queue.
I almost did that:
2 exchange 3 queues:
queue.active (dlx exchange.to_wait)(the queue that the java knows)
queue.waiting (ttl 60sec dlx to exchange.to_active_or_error)
queue.error
exchange.to_wait(direct type, binded to queue.waiting)
exchange.to_active_or_error(header type, redirect to active ou error AND THAT IS THE PROBLEM)
The problem: There is a "count" in the header and would be easy if I can use it in the header exchange(exchange.to_active_or_error) but the count is in the x-death header that is a array of json and the count is just one attribute of that:
x-death=[
{reason=expired, count=3, exchange=exchange.waiting, routing-keys=[],
time=Mon Jan 28 18:23:50 BRST 2019, queue=q.ehh2},
{reason=rejected, count=3, exchange=exchange.active, routing-keys=[],
time=Mon Jan 28 18:22:50 BRST 2019, queue=queue.active}]
How can I do that? Any idea? Another solution?
Remember: I can read the x-death[position].count header in the java code but I want resolve that in the exchange.