Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

When talking about the lifecycle of a workflow, it is important to distinguish the workflow definition from the workflow instances. Workflow instances are the executable processes at runtime. One or multiple workflow instances can be created based on one single workflow definition. 

The lifecycle of one single workflow instance includes: Creation, Activation and Execution, Waiting, and Completion and Deletion.

In TQL and ADL in general, one instance of a workflow is executed only once and will be removed to trash as soon as it completes.

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?)

  • No labels