Piper Push Cache Documentation Download Samples Contact  

Spawn Actor

The spawn actor is an asynchronous task that passes a JSON record to a separate application. That application is started by the actor using a shell command. The application is expected to accept a JSON stream input on stdin and output the result on stdout. The application can either run once or accept repeated inputs. If it runs once and exits or fails at some point it will be restarted on the next pass. Results are expected to be returned asynchronously.

The number of links and link identifiers should match what ever the spawned application indicates the next link is. The JSON format for input is a JSON object with an 'id' field and a 'rec' field. The output expected is an 'id' field, 'rec' field, and a 'link' field that identifies the link to follow.

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

    "task-x": {
        "actor": "spawn",
        "trace": false,
        "path": "/usr/bin/my-app",
        "args": [ "-x", "hello" ],
         "links": {
            "a": "task-a",
            "b": "task-b"

Parameters the spawn actor expects are:

path The path to execute that starts the application.
args An array of strings to pass as arguments to the application.
timeout The timeout in second waiting on a response from the spawned application before taking the error transition. A value of 0.0 indicates no waiting and no tracking of missed responses.