Service Arrangement and De-centralization


Service coordination

When there are multiple services that need to coordinate with each other, there are mainly two ways to implement complex workflow: using a centralized Orchestrator or using decentralized interaction.

Centralized arrangement

A centralized orchestration program coordinates multiple services through a process to complete a large-scale workflow. The service is completely unaware of the workflow itself and the specific details involved. Orchestration processes complex arrangements and coordination, such as enforcing the order in which different services are run, or trying again after a service request fails. In order to ensure that the choreographer knows the progress of execution, the communication is usually synchronous at this time. The biggest challenge in using orchestration is to establish business logic in a centralized location.

De-centralized interaction

In the decentralized interaction, each service in the larger workflow will be entirely responsible for its own role. Services usually listen to each other and finish their work as soon as possible. If there is an error, try again as soon as possible and send out relevant events after the execution is completed. At this time, the communication is usually asynchronous, and the business logic remains in the relevant services. The challenge of this approach is to track the overall progress of the workflow. De-centralized interaction can better meet our requirements: weak coupling, high cohesion, and each service is responsible for its own boundary context. All these features can ultimately improve the team’s autonomy. This method can also be used to track the overall status of the workflow in a passive way by monitoring the events emitted by all other coordinated services through the service.