Asynchronous Connections
The events we have worked with so far in this book have been synchronously handled. The domain events in Chapter 4, Event Foundations, were used to move the side effects of domain-model changes into external handlers.
External handlers were called after the change was made successfully and within the same process. In Chapter 5, Tracking Changes with Event Sourcing, we used events to record each change made to our domain aggregates. When we want to use an aggregate, we read all of the events in sequence to rebuild the current state of the aggregate. With both kinds of events, our system is immediately or strongly consistent because events are always created or read within a single process.
We will be covering the following topics in this chapter:
- Asynchronous integration with messages
- Implementing messaging with NATS JetStream
- Making the Store Management module asynchronous
The events we will be working with in this chapter and for...