Mar 31, 2022
Hi Yossef,
I can think of following approach:
- Try to read one row at a a time, publish that event and update/delete it. Even if multiple instances of Order services are there it is very unlikely that they all will try to read the same row.
- Putting a lock on the record getting updated to ensure that only one process/instance can update it.(can be achieved using sql stored proc or transaction).
- Use inbox pattern: Receiving service can receive and insert these incoming events and then process it later. While inserting in database it can ignore duplicates. The motto of Outbox pattern is to send at least once.
Hope I answer your question.