Piper Push Cache Documentation Download Samples Contact  

Flow Configuration

Flow configuration files must be a single JSON object. The elements of the top level JSON object include a trace flag, the entry task identifier, the on_error task identifier if there is one, and a list of tasks in the flow.

The primary configuration file can also include a section named 'flow' that contains all the flows and tasks only to set the trace parameters.

An example of a flow description as a JSON document is:

{
    "trace":false,
    "id": "nats_router",
    "entry":"chglog",
    "on_error":"",
    "tasks":{
        "chglog":{
            "trace":false,
            "actor":"chglog",
            "links":{
                "":"cache"
            },
            "graphic": {
                "left": 10,
                "top": 10,
                "width": 160,
                "height": 80,
                "color": "DeepSkyBlue"
            }
        },
        "cache":{
            "trace":false,
            "actor":"cache",
            "links":{
                "next":{
                    "target": "publish",
                    "path": [[210, 170],[210, 290]]
                }
            },
            "graphic": {
                "left": 10,
                "top": 130,
                "width": 160,
                "height": 80,
                "color": 573439
            }
        },
        "publish": {
            "actor": "nats_publish",
            "trace": false,
            "subject": "out.<kind><id>",
            "graphic": {
                "left": 10,
                "top": 250,
                "width": 160,
                "height": 80
            }
        }
    }
}

In the Piper Flow viewer.


The meaning of the elements are:

id The flow identifier or name.
trace A boolean that if true will cause all transitions to be logged if the log FLOW category is true. If not present the value is assumed to be false.
entry Identifies the entry task of the flow.
on_error Identifies the on_error task of the flow if there is one. If blank the default error handling of logging an error is called.
tasks All the tasks in the flow are included in the tasks element. The key of each member is the task name and the value of the member is the task description.

Each task includes an actor element. This is required. The task description can also include a trace flag and a links element.

actor Specifies the actor to use for processing. Actors define the processing that the task performs when a record arrives. The available actors are:
async Add a thread to the flow. (see help actor_async)
cache Add a record to the cache. (see help actor_cache)
chglog Write a record to the change log. (see help actor_chglog)
nats_publish Publish a record using NATS. (see help actor_nats_publish)
split Follows all links in parallel. (see help actor_split)
join Join parallel paths. (see help actor_join)
switch Picks a path based on expressions. (see help actor_switch)
spawn Spawn a process to process records. (see help actor_spawn)
remote Use a remote app for processing. (see help actor_remote)
http Send an HTTP request. (see help actor_http)
transform Rule based record transformer. (see help actor_transform)
trace A boolean that if true will cause the trasitions into and out of the task to be logged if the log FLOW category is true. If not present the value is assumed to be false.
links A set of links from the task. Keys are the link identifiers and the value is the task identifier at the end of the link. Optionally a JSON object can be used with a target and path member. The path is an array of arrays that are the x and y coordinates of each point on the path between the task and the linked task.
graphic Graphical description consisting of the bounds of the box representing the task plus a color.
<param> Other actor specific parameters.