...
In TQL, each instance of a workflow (or process) can only be executed once. However, in many circumstances, you may want a workflow to be executed multiple times, for instance, the process to update an attribute value may needs to be repeated every time a sensor event comes in. Such "repeatable workflows" are represented as process streams where each process instance is a self-contained independent copy of the original workflow [definition] running with specific arguments.1
Repeatable versus non-repeatable workflows
a. Non-repeatable (single-run, non-stream) workflows (used in AppFacets)
Such workflows runs for a single time and never repeats. If you do not specify the "While" modifier for the first workflow task, a workflow will run only once. (By default a task's while = "false".) Non-repeatable workflows should be started immediately after compilation (i.e. after it is deployed) without waiting for any events for it to activate or continuebe activated or continued. The originating pipeline, which instantiated the workflow, will wait until the workflow completes.
Examples of non-repeatable workflows are often used in AppFacets.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
place holder for example of non-repeatable workflow |
2b. Repeatable (multi-run, stream) workflows - usually used to process (sequence of) events These are workflows which have while=”true” on one of its tasks (it must be the first task due to compiler limitation, needs to be "texally" first - the the order of appearance in your source code. All others can have it, but it does not matter). These workflows are implemented
Such workflows are implemented as a stream (i.e. a sequence) of single-run instances which are called “process”, thus “stream of processes” or “process stream” terms. These fall into following categories:Default behavior is to be asynchronous They are usually used to process sequences of events. Repeatable workflows are defined by using the "While" modifier (While = "true") for its tasks. The originating pipeline, which instantiated the workflow, does not wait for the workflow (fire-and-forget) start (the originating pipeline does not wait, it continues) a) .
Note | ||
---|---|---|
| ||
Due to the current compiler limitation, you must use While = "true" for the first task that appears in your workflow definition (source code) in order for the compiler to recognize that this is a repeatable workflow. You do not need to specify While = "true" for the subsequent tasks in the same workflow definition. |
Non-waiting versus externally-activated workflows
a. Non-waiting workflows
Instances of these are started right after creation. They are only useful if they are doing something or communicating with some other entities [en-masse] which is difficult with non-repeatable workflows. (initial task(s) starts right away, make sure all inputs already have values assigned in your source code)
...