If I have a 2 webhook topics, where one depends on the other (from a third party system, which I cannot modify)
eg payload 1 (order)
{
id: 12,
order_number: 45666
...
}
payload 2 (customer)
{
order_id: 12
...
}
Now assuming the third party uses queues to manage their webhooks you cannot assume that the webhooks will arrive in correct order, more-so, they might arrive at the same time on your concurrent server
these are the 2 solutions I've come up with
Solution 1 Ignore the customer webhook completely and query the customer API endpoint when the webhook arrives
pros - will work in sequence
cons - could hit API limit very quickly if there is a surge in orders
Solution 2 Requeue the customer webhook after a timer has hit , say intervals of 5, 20 100, 500 seconds
pros - requires less API calls
cons - could fail if the webhook is never delivered
Can someone with experience dealing with this let me know if either is a good solution or their is a better one out there?
Aucun commentaire:
Enregistrer un commentaire