pull down to refresh

Click here to solve this RACE CONDITION challenge in a DISTRIBUTED purchasing SYSTEM.

https://m.stacker.news/10759

DISCLAIMER: It is a simplified and hypothetical scenario. (The diagram is in English because you guys are all stupid, but know that I prefer it in pt_BR ).

I believe this challenge is suitable for those who are already accomplished – perhaps Sandy and Junior will struggle a little to solve it.

SCENARIO: A set of applications with asynchronous customer registration and purchase payment processing services.

However, there is the assumption that a customer must already be persisted in the payments service bank for payments to be processed.

https://m.stacker.news/10760

And for this premise to be satisfied, the registration service issues an event whenever a customer is registered. The image shows this flow.

(Note: This pattern in which the payment service stores a customer reference is called "Event-Carried State Transfer"

https://m.stacker.news/10761

THE PROBLEM:

However, for new customers, it sometimes happens that the command to process the payment is consumed before the customer registration event is consumed. We have a RACE CONDITION scenario!

https://m.stacker.news/10762