...
Code Block |
---|
language | xml |
---|
title | Repeatable workflow example |
---|
linenumbers | true |
---|
|
<ThingFacet Name="TempFacetSerial">
<Number Name="tempValue" update="auto" KnownBy="SerialReadAction" />
<String Name="unit" default="Celsius" Documentation="Celsius or Fahrenheit" />
<String Name="peripheral" />
<String Name="interfacePort" />
<String Name="interface" />
<String Name="uniqueId" default="56789" />
<String Name="baudrate" />
<String Name="format" default="ascii" />
<String Name="operation" />
<String Name="payload" />
<Action Name="SerialReadAction" Documentation="Start the serial port">
<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>
<InterfacePort>"[%:Event.Argument.interfacePort.Value:%]"
</InterfacePort>
<Baudrate>"[%:Event.Argument.baudrate.Value:%]"</Baudrate>
<Interface>"[%:Event.Argument.interface.Value:%]"</Interface>
<UniqueId>"[%:Event.Argument.uniqueId.Value:%]"</UniqueId>
<Operation>"[%:Event.Argument.operation.Value:%]"</Operation>
<format>"[%:Event.Argument.format.Value:%]"</format>
<Payload>"[%:Event.Argument.payload.Value:%]"</Payload>
<Peripheral>"[%:Event.Argument.peripheral.Value:%]"</Peripheral>
</Value>
</Message>
</Invoke>
<Output name="Result" as="ActionResult">
<Value>
<tempValue>
[%:Invoke.InvokeSerialRead.Message.Value/number(
substring-before(substring-after("[%:Invoke.InvokeSerialRead.Message.Value:%]",
'#TCB:'), '#')):%]
</tempValue>
</Value>
</Output>
</Task>
</Workflow>
</Action>
</ThingFacet> |
...
Code Block |
---|
language | xml |
---|
title | Example of non-waiting workflow |
---|
linenumbers | true |
---|
|
Placeholder for example of non-waiting workflow |
b. Externally-activated workflows
These are workflows which have explicit “event handler”. Instances of these workflows wait for the external event to come and then start ("external" here means external to the workflow itself). The "event handler" is written as "Event" in the workflow definition. In ThingFacet (and AppFacet) workflows, the Event is typically the ActionArgument, which is triggered by the modification of actionable attributes of the model facet.
Jira Legacy |
---|
showSummary | false |
---|
server | JIRA (mqidentity.atlassian.net) |
---|
serverId | 77fb3325-4051-36d9-bcc7-761f62050707 |
---|
key | DOCS-36 |
---|
|
Code Block |
---|
language | xml |
---|
title | Example of externally-activated workflow |
---|
linenumbers | true |
---|
|
Placeholder for example of externally-activated workflows. |
Externally-continued versus internally continued workflows
a. Externally-continued workflows
These have an invoke with the WaitFor modifier. Instances of such workflows can start, work for a while and then suspend and wait for an event in the middle of task (on the waitFor). Once wait is completed they continue until the next WaitFor or process completion (The "external" here means external to the workflow itself).
Jira Legacy |
---|
showSummary | false |
---|
server | JIRA (mqidentity.atlassian.net) |
---|
serverId | 77fb3325-4051-36d9-bcc7-761f62050707 |
---|
key | DOCS-36 |
---|
|
Code Block |
---|
language | xml |
---|
title | Example of externally-continued workflow |
---|
linenumbers | true |
---|
|
Placeholder for example of externally-continued workflow<Action name="SetOutput">
<Workflow Limit="1" Live="1" Timeout="-1">
<Task name="Step1">
<Input name="Argument" type="string" kind="literal" value="Hello World!"/>
<Output name="Result" type="string" value="Step1 says '[:Input.Argument:]'"/>
</Task>
<Task name="Step2">
<Input name="Argument" type="string" value="Step1.Result"/>
<Output name="Result" type="string" value="Step2 says that '[:Input.Argument:]'"/>
</Task>
<Task name="Step3">
<Input name="Argument" type="string" value="Step2.Result"/>
<Output name="Result" type="string" value="Step3 says that '[:Input.Argument:]'"/>
</Task>
<Task name="Step4">
<Input name="Argument" type="string" value="Step3.Result"/>
<Output name="Result" type="string" value="Step4 says that '[:Input.Argument:]'"/>
</Task>
</Workflow>
</Action> |
b. Externally-activated workflows
These are workflows which have explicit “event handler”. Instances of these workflows wait for the external event to come and then start ("external" here means external to the workflow itself). The "event handler" is written as "Event" in the workflow definition. In ThingFacet (and AppFacet) workflows, the Event is typically the ActionArgument, which is triggered by the modification of actionable attributes of the model facet.
Jira Legacy |
---|
showSummary | false |
---|
server | JIRA (mqidentity.atlassian.net) |
---|
serverId | 77fb3325-4051-36d9-bcc7-761f62050707 |
---|
key | DOCS-36 |
---|
|
Code Block |
---|
language | xml |
---|
title | Example of externally-activated workflow |
---|
linenumbers | true |
---|
|
<Action name="SetOutput">
<Workflow Limit="1" Live="1" Timeout="-1">
<Task name="Step1">
<Event name="Argument" as="ActionArgument" />
<Output name="Result" type="string" value="Step1 says '[:Event.Argument:]'"/>
</Task>
<Task name="Step2">
<Input name="Argument" type="string" value="Step1.Result"/>
<Output name="Result" type="string" value="Step2 says that '[:Input.Argument:]'"/>
</Task>
<Task name="Step3">
<Input name="Argument" type="string" value="Step2.Result"/>
<Output name="Result" type="string" value="Step3 says that '[:Input.Argument:]'"/>
</Task>
<Task name="Step4">
<Input name="Argument" type="string" value="Step3.Result"/>
<Output name="Result" type="string" value="Step4 says that '[:Input.Argument:]'"/>
</Task>
</Workflow>
</Action> |
Externally-continued versus internally continued workflows
a. Externally-continued workflows
These have an invoke with the WaitFor modifier. Instances of such workflows can start, work for a while and then suspend and wait for an event in the middle of task (on the waitFor). Once wait is completed they continue until the next WaitFor or process completion (The "external" here means external to the workflow itself).
Jira Legacy |
---|
showSummary | false |
---|
server | JIRA (mqidentity.atlassian.net) |
---|
serverId | 77fb3325-4051-36d9-bcc7-761f62050707 |
---|
key | DOCS-36 |
---|
|
Code Block |
---|
language | xml |
---|
title | Example of externally-continued workflow |
---|
linenumbers | true |
---|
|
<Action Name="SerialReadAction" Documentation="Start the serial port">
<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>
<InterfacePort>
"[%:Event.Argument.interfacePort.Value:%]"
</InterfacePort>
<Baudrate>
"[%:Event.Argument.baudrate.Value:%]"
</Baudrate>
<Interface>
"[%:Event.Argument.interface.Value:%]"
</Interface>
<UniqueId>
"[%:Event.Argument.uniqueId.Value:%]"
</UniqueId>
<Operation>
"[%:Event.Argument.operation.Value:%]"
</Operation>
<format>
"[%:Event.Argument.format.Value:%]"
</format>
<Payload>
"[%:Event.Argument.payload.Value:%]"
</Payload>
<Peripheral>
"[%:Event.Argument.peripheral.Value:%]"
</Peripheral>
</Value>
</Message>
</Invoke>
<Log
Message="Invoke --> [%:Invoke.InvokeSerialRead.Message.Value.received:%]" />
<Output name="Result" as="ActionResult">
<Value>
<tempValue>
[%:Invoke.InvokeSerialRead.Message.Value/number(
substring-before(substring-after("[%:Invoke.InvokeSerialRead.Message.Value:%]",
'#TCB:'), '#')):%]
</tempValue>
</Value>
</Output>
</Task>
</Workflow>
</Action>
|
b. Internally continued workflows
...