Always receive a webhook though a queue

Always receive a webhook though a queue

If you designing a microservice that is exposing a webhook that you are expecting another micro-service to hit, always make sure that the webhook controller is bare-bones and just adds the request to a queue and respond back. Sending microservice is supposed to have retry mechanisms. But this approach assumes the sender is not sophisticated.

Advantages for doing things this way:

  • Webhooks are accepted much faster(controller now just accepts the requests, adds it to a queue and responds)
  • Chances of run time error and losing the data is minimized
  • Changes of production database taking time and request timing out are minimized
  • Must easy to reply requests and fix issues in the controller

We use bull for queueing things.

Alex J V
Posted on:
Post author

Leave a comment

Your email address will not be published. Required fields are marked *