Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • Thank you for your answer. RE: the wording around order creation, yes that could be more clear. My intention is that the order service simply emits an event indicating that the order was created and it would be the responsibility of the inventory microservice to consume that event and update inventory accordingly. I think my issue is a mix of 1 and 2. Stock that is physically missing is always a problem and falls clearly into case 2. But I also don't want to introduce this issue unnecessarily by allowing buyers to buy things that are known to be out of stock. Commented Sep 5, 2018 at 14:13
  • 2
    OK about the events. I agree that you want to limit scenario number 2 as much as possible, but given that you cannot avoid it completely, you have to deal with it. I could think of ways to minimise the "race condition" (which as another answer points out it's not a real race condition, as business processes don't really work at the seconds level), but I would need to know more about the implementation, sorry. Commented Sep 5, 2018 at 14:39