Nameko currently discovers "sub-extensions" by inspecting declared Entrypoints
and DependencyProviders
for nested Extension
class attributes. All the discovered entities then setup()
, start()
and stop()
together, in a non-deterministic order.
The non-determinism is hard to reason about and sometimes causes problems when extensions have strict expectations about the order in which their sub-extensions are started — an Extension can't be sure that setup
on its sub-extension will finish executing before its own setup
executes (example)
Instead of this mechanism, we should delegate the setup
, start
and stop
of sub-extensions to the owning extensions rather than doing everything in pseudo-parallel. This will make reasoning about when extensions start and stop easier.
With this change, sub-extensions would no longer need to be declared on the class of their owning extension. Owning extensions would instantiate them directly, making it easier configure them (for example, with arguments dynamically determined during the construction of the owning extension).