Functioning with asynchronous communication
Let us revisit some vital definitions and concepts before moving forward.
There are basically two messaging patterns that we will employ between microservices:
- Synchronous communication: We covered this pattern in the previous chapter, where one service calls another directly and waits for a response
- Asynchronous communication: In this pattern, we use messages to communicate without waiting for a response
There are times when one microservice needs another to complete an operation, but at the moment, it doesn’t need to know the outcome of the task. Let us think of sending confirmation emails after an appointment has been successfully booked by our health care management system. Imagine the user waiting on the user interface to complete its loading operation and show the confirmation. In between them clicking Submit and seeing the confirmation, the booking service needs to complete the following operations:
...