Using an Inbox for Messages
Learn how to implement message inboxes for the Depot module.
We have now updated the Depot
module so that we can work with a single database connection and transaction. We want to now use that to make our database interactions and message publishing atomic.
When we make the publishing and handling of the messages atomic alongside the other changes that are saved into our database, we gain the following benefits:
Idempotent message processing: We can be sure that the message that we are processing will only be processed a single time.
No application state fragmentation: When state changes occur in our application, they will be saved as a single unit or not at all.
With the majority of the work to set up the transactions behind us, we can now implement the inboxes and outboxes for our messages.
Implementing a messages inbox
We presented a way in which we could ensure that no matter how many times a message was received, it would only be handled one time.
Get hands-on with 1400+ tech skills courses.