We have a complex app which built by using multiple microservices. At a runtime, one of the microservices emits an event to initialize some maintenance process in another microservices, it's ok. But lately, we were required to initialize a maintenance process at the same service from which this event was being emitted, and at the same time when this event is emitted.
My team leader thinks that this maintenance process should be started by performing a simple function call from code which emits events. I think that it will be more reasonable that service will listen to the event which it emits, and upon arriving this event maintenance process will be started.
I want to keep a consistent way in which all microservices initial the same process. It disturbs me that in one microservice this maintenance will be invoked in one way, while in other in a different way. Also, I think this is functionality which needs to be loose coupled.
What do you think?
My team leader thinks that this maintenance process should be started by performing a simple function call from code which emits events
your leader is right. It's part of the SRP of the process that emits the event.I think that it will be more reasonable that service will listen to the event which it emits, and upon arriving this event maintenance process will be started
that would be similar to a goto, and they are evil. Right? :-)