Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leverage advanced RabbitMQ features to implement cheap webhook retry mechanism #58

Open
YoannAubineau opened this issue Oct 8, 2016 · 0 comments

Comments

@YoannAubineau
Copy link
Contributor

Currently, webhook messages whose HTTP call fails are consumed and requeued from/to RabbitMQ continuously. Doing so wastes a full CPU core for nothing. A less costly approach would be to use the dead-letter mechanism RabbitMQ provides.

Here is the general idea:

  1. After each ballot, a webhook message is enqueued into the webhook queue.
  2. The webhook worker consumes these messages in order and tries to call the associated remote server.
  3. It the call fails, the worker rejects the webhook message.
  4. Rejected messages are automatically routed to an isolation queue with no consumer.
  5. After a certain amount of time, isolated messages are automatically sent back to the webhook queue.
  6. The message can be rejected and delayed this way many times.
  7. When the webhook call succeeds, the worker acknowledges the message. Done.
  8. If the message becomes too old, the worker can silently acknowledge it to make it disappear from the queue.

This mechanism requires subtle configuration that I will describe here once I manage to have working POC.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants