Challenges and considerations
Microservices represent a distributed architecture, meaning each service runs in its own process. However, we must beware of the fallacies of distributed systems! We will cover these in detail in the upcoming subsection. Transitioning from a monolith to a microservices architecture involves analyzing numerous factors. So far, we have focused on the architectural aspects of the system and explored how to gradually refactor your code to prepare your monolith for decomposition.
Introducing the events in your monolith seems to be an over-engineering approach, and it is if you don’t need to split the monolith. However, because you are looking for a safe appropriate approach, it isn’t! With events, you can easily debug the whole system, even if the communication is asynchronous, by setting the appropriate breakpoints in your code and inspecting the process. At the end of this step, you can be confident that the system still works after moving...