Workflows

A workflow consists of a sequence of tasks that are orchestrated and repeatable. Each task may process events, generate events, or process information. A workflow can be defined as part of an Action or as part of a Query.

Workflows are defined by Workflow Definition Language (WDL). Workflow can have a WorkflowId (wid). In run time, a workflow can have multiple instances (or called processes). Each process or instance is a single incarnation of the workflow definition.

TQL workflow should not be confused with business workflows. Business workflow is a set of business activities driven by data exchanges, work executions and people interactions. TQL workflow is a sequence of tasks that are strictly computer system based and purely data driven. So TQL workflow can execute very "low level" device communications such as messaging, as well as very "high level" application logic. 

A task can have the following structure: 

Input - any data which is required for the task to be started. Unless all inputs are available, the task will wait.

Output - any data which is generated by the task for externals to consume. One task's output may be the input for another task in the same workflow.  

Invoke - the process part of the task. Invoke may execute script, listen to protocol handler or send data to protocol handlers.

The sequence between multiple tasks in the same workflow is driven by the dependencies between their inputs and outputs. Since tasks generally only start on receiving their inputs, their sequences are only determined instance by instance at runtime.

Workflow example
<Workflow Limit="1" Live="1" Timeout="-1">
	<Task name="Main" while="true">
		<Event name="Argument" as="ActionArgument" />
		<Invoke name="InvokeSerialRead" waitFor="Argument" get="perif://">
			<Message>
				<Value>
					...
				</Value>
			</Message>
		</Invoke>
		<Output name="Result" as="ActionResult">
			<Value>
				...
			</Value>
		</Output>
	</Task>
</Workflow>