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
Uh oh!
There was an error while loading. Please reload this page.
-
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
Orchestratorwhich 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
Orchestratorshould implement the interfaceServicewhich has two methods:Start() (errCh chan error, err error)andStop() error.-
Startmethod should return a error channel to the main caller, this channel will be responsible for notify the main parentOrchestratorthat something went wrong inside the running service and we need to shutdown gracefully the node. The second return paramerroris used when the service failed to start.-
Stopmethod should shutdown the service gracefully, for example: stop running goroutines or saving the current state of the node. And theStopmethod should close the returned error channel. TheStopmethod wil be called by theOrchestrator.The
Orchestratorwill 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 theOrchestratoronly initialize the dependent service once the dependency is ready.The
Orchestratorshould be aware of the problems inside the services so it need to collect and track the returnedchan errorfrom each service and listen from them in order to shutdown the node gracefully.Beta Was this translation helpful? Give feedback.
All reactions