I'm working on a project where I got an architecture with multiple Microservices communicating with each other by using an event bus (RabbitMQ).I got an Web API-project set up for each service so the outside world can send commands using REST-calls.When my Web-API receives a call, it sends the command down to my domain-layer where I process that command and persist any data if its necessary. When that's done I update my surrounding services by publishing an event with the corresponding data.The thing I'm struggling with is the receiving end of the event-driven communication. How can a microservice be ready to accept API-calls from the outside world and have some event-handler waiting for incoming events at the same time? It feels like this shouldn't be some other service but I can't think of any other way to deal with this problem.I hope that the following image will make things clearIf we have a banking system and when we want to create a customer, we need the account-service to react to that event and create an account for him. How can we make sure that the Account Service is ready to receive API-calls and simultaneously handle the events from the event bus?
Handling events and incoming Web API calls simultaneously
event programming;microservices;web api