Routing Data from Workspaces
All Run a Workspace actions allow you to route messages depending on whether the workspace completes successfully or not. However, if the workspace is configured with FME Server Automations writers, your Automations workflow can also send messages based on the actual results of your workspace logic. Additionally, these messages can contain feature type information derived from the workspace.
For example, consider a workflow that receives emails and runs a workspace, which performs some sort of validation on attached files from the emails. Features in the attachment that pass validation are read into a database. With the addition of FME Server Automations writers, you can configure the workflow to send messages on the results of the validation, including details on feature type attributes. You can send one message about features that passed validation and were read into the database, and another message about features that failed validation. In the workspace, these messages correspond to the output written to two Automations writers, as seen here:
Mouse-over to view screenshot:
When the workspace is uploaded to FME Server and referenced in a Run a Workspace action of an Automations workflow, it looks like this:
Mouse-over to view screenshot:
Notice that the Run a Workspace action has two additional output ports (circled). The name of each additional output port matches the name of its corresponding feature type, as defined by the FME Server Automations writers. (Also notice that, in addition to the messages sent from these additional ports, the workflow sends messages based only on whether the workspace runs successfully or not.)
The two additional ports output JSON-formatted key-value pairs that correspond to the feature type attributes exposed in the writers:
Mouse-over to view screenshot:
These keys are available as Workspace parameters in downstream components of the workflow.
Looping Data between Workspaces
If your workflow has multiple Run a Workspace actions in sequence, you can loop the output from feature types back to a previous Run a Workspace action in the sequence until some condition is met that enables the features to output elsewhere. To enable looping, select Enable Looping from the canvas menu. When looping is enabled, you can draw connections from feature type output ports back to the input ports of upstream Run a Workspace actions. This setting applies to the current workflow, as well as subsequent workflows that you open. On the canvas, loops appear as dotted connection lines.
WARNING: Looping is an advanced feature. Exercise caution to avoid creating infinite loops that may overload your FME Engines. Additionally, looping upstream of a Merge Messages action is not recommended and may lead to unexpected behavior.
To disable looping, select Disable Looping from the canvas menu. Any existing loops remain in place.