Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Gliffy
nameLifecycle of workflow instance

Definition

Instance creation

Instance activation and execution

Instance deleted

...

Workflow Lifecycle

    Workflow is written in XML form by using the language defined under Workflow grammar. Once definition is passed to engine, it gets compiled and kept in the system. At the time of use, it gets deployed in TQLEngine memory linked with the right pipeline. Once message is received on this pipeline, workflow staged memory frame becomes instance to process the event and workflow gets executed. After execution, this frame is destroyed.

    Workflow definition is just a document in the system. Once it gets deployed, it creates as many frames in the memory as defined by the limit. When message is received for the workflow, frame is handed over for processing and as many instances can be there as defined in live. If number of messages on the pipeline exceeds number of live, then messages gets queued till current workflow instances completes their work and gets destroyed.

Workflow Stream

   Workflow  is triggered by incoming messages, which provides Input to the task/s (Once all inputs are set, task gets started). Till Input gets consumed by the workflow, there may be waiting inputs for next iteration of the workflow and that is what defined as workflow stream.

Thing Facet Workflow

When workflow is used as part of the Thing Facet Action, its lifecycle is inherited by the thing facet lifecycle. Action is triggered at the update of actionable attribute. If Task has modifier - 'while="true"', then task will continue to run forever.

<Workflow Limit="1" Live="1" Timeout="-1">

            <Task name="Main" while="true">

                <Event name="Argument" as="ActionArgument" />

....

here, ActionArgument is passed as current state of the ThingFacet, when actionable attribute is modified by the TQL Query.

When model gets instantiated, action will trigger only if actionable attribute is set any value. hence following is used in general, when action need to be forced to be triggered at the time of the instantiating model

    

<Create format="version,current">

        <TempSensor>

            <tempValue>$Null()</tempValue>

        </TempSensor>

 </Create>

In this case tempValue is defined as actionable attribute.

Explain the relationship of the workflow lifecycle and the model lifecycle (e.g. when a model gets instantiated, does a workflow gets instantiated?)A repeatable workflow (definition) can turn into multiple workflow instances. These workflow instances can run asynchronously with each other (in parallel).

When a workflow definition is deployed (along with the Model that contains it), the A-Stack will create workflow instances based on the workflow "Limit" modifier value and let them sit in the buffer waiting to be activated. For example, if Limit = "3", there will be at most 3 instances of the same workflow (from the same model definition) in the buffer at any time.

The workflow instances can be activated when the ActionArgument of the first workflow task arrives (In ThingModels this is triggered by the actionable attribute value changes). Multiple instances of the same workflow can be running at the same time, subject to the workflow modifier "Live". For example, if Live = "2", 2 instances of the same workflow (from the same model definition) can run at the same time.

Each workflow instance is removed upon completion, as described above. New instances can be activated. In the case where the actionable attribute has the modifier Update = "auto", a new instance of the workflow will be automatically activated as soon as a previous instance is completed.

A non-repeatable workflow can only have on instance and run only once. The single instance is activated right after the workflow definition is deployed (along the the Model that contains it).  

Gliffy
nameLifecycle of workflow

Note
iconfalse
titleSee also


Workflow variations and modifiers

Workflow modifiers

Lifecycle of models

Actions

Actionable attributes

Automatic action trigger