Pipeline Routing
Overview
Usually layers in a pipeline are executed linearly, but sometimes you may want to execute layers in a different way. For example, you may want to execute a pipeline in a different order, go back to a previous layer, or even skip to another layer.
To achieve this, you can use the Router feature inside an actor. You can enable this feature by opening an actor settings and, in the 'General Information' tab, you'll see the 'Router' option (disabled by default).
An actor with this feature enabled will work the same way as a normal actor, but it will have the ability to route the output to another layer.
Router Commands
Target Route
To use routing through an actor, you must make the actor return a JSON object with the following structure:
{
"targetRoute": <layer_number>
}
Where <layer_number> is the number of the layer you want to target. The layers starts from 0, so the first layer is number 0, the second is number 1, and so on.
You can also add any other custom field you could need, you just need to implement a way to handle it in the actor that will receive the output.
Target Route END
You can also use the END keyword to finish the pipeline execution:
{
"targetRoute": "END"
}
In this case, you could also add a "message" field to the JSON object to send a message to the user.
{
"targetRoute": "END",
"message": "The pipeline has ended because of a bad request."
}