This object is fully managed by a FlowExecution within a stack-based data
structure, where each session in the stack is a spawned flow at a specific
state. The session at the top of the stack is the currently active flow. This
stack of all flow sessions captures the complete and current state (snapshot)
of an executing flow.
A flow session will go through several status changes during its lifecycle.
Initially it will be CREATED . For example, when a
new FlowExecution is started to launch a new root Flow definition a new
FlowSession is created.
When a flow session is activated (about to be manipulated), it's status
becomes ACTIVE . In the case of a new
FlowExecution, session activation happens immediately after creation to put
the "root flow" at the top of the stack and transition it to its start state.
When control returns to the client for user think time, the status is updated
to PAUSED . The flow is no longer actively
processing: it's stored off somewhere waiting on the user to participate.
If a flow session is pushed down in the stack because a subflow is spawned,
its status becomes SUSPENDED until the subflow
returns (ends) and is popped off the stack. The resuming flow session then
becomes active once again.
When a flow session is terminated because an EndState is reached, its status
becomes ENDED , ending its lifecycle. The session
is popped off the stack and discarded, and any allocated resources in "flow
scope" are automatically cleaned up.
Note that a flow session is in no way linked to an HTTP session! It
just uses the familiar "session" naming convention to denote a stateful