Petals ESB lifecycles

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (36)

View Page History
The Petals ESB container life-cycle is very simple.
{gliffy:name=Petals ESB lifecyle|version=2}
It contains only one state: STARTED. The implicit state 'STOPPED' state does not really physically exist because in such state no Petals ESB process is running.

The transition from state 'STOPPED' to 'STARTED' is realized using the Petals ESB startup script '{{petals-esb}}'. The return to the state 'STOPPED' is realized using {{^C}} or the command '{{petals-esb stop}}'. See [Starting and stopping Petals ESB].

*When stopping a Petals ESB container, _all its components are shutdown_*. When starting the Petals ESB container, shared libraries, components, service assemblies and service units are restored to the state in which they was were when stopping the container.

{anchor:sharedlibrary-lifecycle}
The shared-library life-cycle is simple.
{gliffy:name=Shared-Library lifecyle|version=3}
It contains only one state: INSTALLED. The implicit state 'UNINSTALLED' does not really exist because the shared-library is not instantiated or loaded.
It contains only one state: INSTALLED. The implicit state 'UNINSTALLED' does not prysically exist because the shared-library is not instantiated or loaded in memory at that time.
The transition from state 'UNINSTALLED' to 'INSTALLED' is realized by installing the shared library, and the return to the state 'UNINSTALLED' is realized by uninstalling the shared-library. A shared library can be (un)installed using [Petals CLI|petalsesb:Command Line Interface], [the Petals Autoloader|Petals ESB "Autoloader"], Petals Ant Tasks or the JMX API.

{anchor:sharedlibrary-lifecycle-constraints}

The shared library life-cycle is linked to the component life-cycle:
* a A shared library required by a component must be installed before to load the component can be loaded.
* a A shared library can not be uninstalled until if a component requiring it is installed.

|| Component state || installSharedLibrary || uninstallSharedLibrary ||

The component life-cycle is the more complex life-cycle of Petals ESB life-cycles. It is composed of two correlated sub life-cycles:
* tThe component installer life-cycle that drives the installation of the component,.
* tThe component life-cycle itself.

{gliffy:name=Component lifecyle|version=8}

The state {{INITIALIZED}} is a temporary state in the startup transition. The transition {{init}} and {{start}} are automatically enchained when starting a component from the state {{SHUTDOWN}}.

Actions associated to states:
* wWhen initializing the component:
** tThe endpoints of the [native services|Glossary#Native_Service] are registered,.
* wWhen starting the component:
** iIt will be able to process request messages,.
* when stopping the component, no more request message is processed,
* When stopping the component:
** Request messages are not processed anymore.
** aAll resources (as database, pools, ...) used by the message processing are released,.
* wWhen shutting down the component:
** aAll resources (as database, pools, ...) used by the service unit (un)deployment on state {{STARTED}} and {{STOPPED}} are released,.
** tThe endpoints of the native services are unregistered.

h2. Constraints

The component life-cycle is linked to:
* [the shared life-cycle|#sharedlibrary-lifecycle-constraints],
* [the service-assembly lifecycle|#serviceassembly-lifecycle-constraints],
* the service-unit life-cycle,
* and have following constraint against the service-unit life-cyle:
* [The shared life-cycle|#sharedlibrary-lifecycle-constraints].
* [The service-assembly lifecycle|#serviceassembly-lifecycle-constraints].
* The service-unit life-cycle with the following constraint:
|| Service unit state || loadNewInstaller || install || start || stop || shutdown || uninstall || unloadInstaller ||
| UNDEPLOYED | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! |
| STOPPED | !checkErro.png|align=center,width=20px!| !checkErro.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkErro.png|align=center,width=20px! | !checkErro.png|align=center,width=20px! | !checkErro.png|align=center,width=20px! |
| STARTED | !checkErro.png|align=center,width=20px!| !checkErro.png|align=center,width=20px!| !checkOk.png|align=center,width=20px! | !checkOk.png|align=center,width=20px! | !checkErro.png|align=center,width=20px! | !checkErro.png|align=center,width=20px! | !checkErro.png|align=center,width=20px! |
** component required by a service unit must be installed and running (ie. in state STOPPED or STARTED) before to deploy the service unit,
** if service units are deployed on, a component can only be started or stopped. All service units must be undeployed before to try any other transitions.
** A component required by a service unit must be installed and running (ie. in state STOPPED or STARTED) before the service unit can be deployed.
** A component with service units deployed can only be started or stopped: all service units must be undeployed before applying any of the other transitions.
** sStopping the container is the only way where to have the component is shutdown (without state persistence) even if service units are deployed on.

{anchor:service-assembly-lifecycle}
h2. The life-cycle

The service assembly life-cycle can be viewed as a wrapper of its all service unit life-cycles. It propose to drive the life-cycle of its service-units in on operation.
The service assembly life-cycle can be viewed as a wrapper of all its service unit life-cycles. It drives the life-cycle of its service-units.
{gliffy:name=Service-Assembly lifecyle}

The transitions from state 'UNDEPLOYED' to 'SHUTDOWN' is realized by deploying the service assembly, and the return to the state 'UNDEPLOYED' is realized by undeploying the service assembly. A service assembly can be (un)deployed/started/stopped/shutdown using [Petals CLI|petalsesb:Command Line Interface], [the Petals Autoloader|Petals ESB "Autoloader"], Petals Ant Tasks or the JMX API.

Actions associated to states:
* when deploying the service assembly, each service-unit not in state {{DEPLOYED}} is deployed,
* when starting the service assembly, each service-unit not in state {{STARTED}} is started,
* when stopping the service assembly, each service-unit not in state {{STOPPED}} is stopped,
* when shutting down the service assembly, each service-unit not in state {{SHUTDOWN}} is shutdown,
* when undeploying the service assembly, each service-unit not in state {{UNDEPLOYED}} is undeployed.
* When deploying the service assembly, all service-units not in state {{DEPLOYED}} are deployed.
* When starting the service assembly, all service-units not in state {{STOPPED}} are initialized, then all service-units not in state {{STARTED}} are started.
* When stopping the service assembly, all service-units not in state {{STOPPED}} are stopped.
* When shutting down the service assembly, all service-units not in state {{SHUTDOWN}} are shutdown.
* When undeploying the service assembly, all service-units not in state {{UNDEPLOYED}} are undeployed.

{anchor:serviceassembly-lifecycle-constraints}

The service assembly life-cycle is linked to the component life-cycle:
* tTo realize a transition on the service-assembly life-cycle, the component must be in state STARTED or STOPPED.

|| Component state || deploy || start || stop || shutdown || undeploy ||
The service unit life-cycle is simple:
{gliffy:name=Service-Unit lifecyle|version=3}
The implicit state 'UNDEPLOYED' does not really exist because the service unit is not deployed.
The implicit state 'UNDEPLOYED' does not physically exist because the service unit is not deployed in memory at that point.

Actions associated to states:
* when deploying a provider service unit, its endpoint is registered,
* when starting a service unit, consumption of services or external listening is started,
* when stopping a service unit, consumption of services or external listening is stopped,
* When deploying a provider service unit, it is registered by the component.
* When initializing a service unit, its resources are allocated.
* When starting a service unit, its provides endpoint are registered, external listening is started and consumptions of services are started.
* When stopping a service unit, its provides endpoints are unregistered, external listening is stopped and consumptions of services are stopped,
* When shutting down a service unit, its resources are released.
* when undeploying a provider service unit, its endpoint is unregistered. it unregistered from the component.