In Workflows you can have Named Templates. Normally you can call those with [[ template “yourtemplatename” ]].
To Create such “Named Templates” you can either use Data Objects or Tasks.
There are some predefined Template Names, that are called at specific times / points from the workflow, if they exist.
All the Workflows may contain predefined objects. Those Objects can be:
To make it work the Objects Name has to be the reserved word. That can be one of the following
The startup Object will be executed, when the middleware starts. This will be executed once only and without a given Event from the Hive.
You may load Stuff from hive or disk, or even load data from other workers.
To make sure, you have the needed data, you can make use of the fatal / exit function, if some data is not yet available.
As an example:
If we want to make sure, our resolver workflow can store the classes we want in the resolver worker, we create the needed classes on workflow startup with the given “startup” snippet
[[ log "info" "startup" ]]
[[- $queue := "resolver" ]]
[[- $req := newRequest ]]
[[- $req = setRequestClass $req "user"]]
[[- $req = setRequestOperation $req "createType"]]
[[- $result := goodCall $queue $req]]
Result Code: [[ print $result.Result.Code ]] | Message: [[ print $result.Result.Message]]
[[- if ne $result.Result.Code 200 ]]
[[- fatal (print "Could not init resolver. Result Code: " $result.Result.Code " | Message: " $result.Result.Message ) ]]
[[- end ]]
We can usage “event_start” for many purposes. mostly we find it usefull for logging or debugging.
You may use to log the current request on every step or other stuff.
[[ log "info" ( marshal getRequest) ]]
Just save this snippet into a Task or DataObject with the name “event_start”
Like on the Start of a Event this runs at its end.
“workflow_start” runs at the beginning when a new Request enters the Workflow. Feel free to “use” that for whatever neede Tasks the start of a Workflow run.
Same as proc_start, but runs as last operation, before the workflow is closed. This can be used to set some default results, if none is specified or logging or whatever.
Mapping Start runs right after proc_start. This can be used to map Attributes before the heavy work of the workflow starts.
Mapping Stop runs before the Workflow ends. You may want to map some data before a workflow ends.
On a conditional start, you can use this to add some extra functionality to all the condition starts. You may find it usefull to log the condition.
A snippet can also be run when a condition reaches it convergation point.