Service orchestration architecture #2293
EclesioMeloJunior
started this conversation in
General
Replies: 1 comment
-
Some examples: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This discussion is related to the issue #2235
Description
Currently, in the gossamer codebase, we face the following problem: inner goroutines might fail without warning the outers services.
@timwu20 suggested the approach of an
Orchestrator
which will handler all the service's start and stop functions, and will be responsible for gracefully shutdown the node, waiting for running goroutines stop before exit completely.All the services managed by the
Orchestrator
should implement the interfaceService
which has two methods:Start() (errCh chan error, err error)
andStop() error
.-
Start
method should return a error channel to the main caller, this channel will be responsible for notify the main parentOrchestrator
that something went wrong inside the running service and we need to shutdown gracefully the node. The second return paramerror
is used when the service failed to start.-
Stop
method should shutdown the service gracefully, for example: stop running goroutines or saving the current state of the node. And theStop
method should close the returned error channel. TheStop
method wil be called by theOrchestrator
.The
Orchestrator
will follow a pipeline pattern where we should initialize one service before other to guarantee the dependency chain. Some services might delay a considerable time, in this case we should use a readiness status were theOrchestrator
only initialize the dependent service once the dependency is ready.The
Orchestrator
should be aware of the problems inside the services so it need to collect and track the returnedchan error
from each service and listen from them in order to shutdown the node gracefully.Beta Was this translation helpful? Give feedback.
All reactions