Piper Push Cache Documentation Download Samples Contact  

Switch Actor

The switch actor evaluates a set of filter expressions in order until a match and follows the link associated with that match. A default link is also possible which defaults to the un-named link. A dead-end option exists for when the flow should terminate at this task.

The switch task is synchronous. It can follow any of the links depending on the configured rules.

The JSON used to designate a switch task in a flow description is:

    "task-x": {
        "actor": "switch",
        "trace": false,
        "rules": [
            [ "(< number 3)", "b" ],
            [ "(< number 10)", "a" ],
	    [ true, null]
         "links": {
            "a": "task-a",
            "b": "task-b"

Parameters the switch actor expects are:

rules An ordered list (array) of filter expressions and link identifier pairs. The filter expressions are strings or for the default the JSON boolean 'true'. (see help filter for filter expressions) The second element of the pair, the link identifier identifies the link to follow. A value of JSON null indicates to not follow any link.