alphasights / sneakers_handlers

Retries with exponential backoff for sneakers
MIT License
33 stars 11 forks source link

Use `x-dead-letter-routing-key` argument #2

Closed brianstorti closed 8 years ago

brianstorti commented 8 years ago

Instead of binding the dlx queue to the same routing key as the working queue, we bind it to the value of the argument x-dead-letter-routing-key to avoid sending the rejected message to multiple queues.

Example:

1) Queues a and b are bound to routing key x, in the same exchange; 2) A message is received and consumed successfully by queue a, but queue b rejects it; 3) The handler would publish the message to the dead-letter exchange using the routing key x, causing it to end up in both dead-letter queues (a.dlx and b.dlx).

With this change, as long as these two queues where declared with a different x-dead-letter-routing-key, the message would end up just in the queue that originally rejected it.

We would probably use the queue name as the x-dead-letter-routing-key value to guarantee uniqueness.

jjbohn commented 8 years ago

:+1:

toreriklinnerud commented 8 years ago

@brianstorti should we merge?

brianstorti commented 8 years ago

I'll merge it tomorrow morning. Still need to add this new argument in the workers that are using the gem, shouldn't take more than 10 minutes.