FME Flow: 2024.2
Combining Messages from Multiple Workspace Actions
You can combine the output messages from multiple Run a Workspace and Run a Dynamic Workspace actions in your workflow. When you combine messages, all of the workspaces that comprise a split-merge block run as a result of a single input message, and output a single, combined success and/or failure message to the downstream components of your workflow. The message includes content from workspaces that run a single job, or multiple jobs, depending on the input message and workspace behavior. Additionally, depending on the connections you specify between workspaces, the message can include overall workspace success or failure data, or feature type data from FME Flow Automations writers.
Example
This example sends an email after a set of workspaces completes. A split-merge block receives a message from an Email Received (IMAP) trigger. The block comprises three Run a Workspace actions. Workspace Process State runs one job and outputs county feature type data to workspace Process County. The Run a Workspace action for Process County runs 60 jobs (one for each county), and outputs block feature type data to workspace Process Block, which, in turn, runs 900 jobs (one for each block). The block waits to ensure that all 961 jobs are complete before it outputs a single message to a Send an Email external action.
Nesting Split-Merge Blocks
You can nest split-merge blocks inside one another to control the level by which you want to aggregate output messages from workspace actions. This example nests the Process County and Process Block workspaces from the previous example inside another split-merge block that initiates with workspace Process State. By nesting in this manner, messages are aggregated at the county level for processing, rather than the state level, before being output as a single message. The nested split-merge block outputs one message for each county, combining all of a county's block data. Each message is input to the workspace actions in the outer split-merge block for processing. When complete, a single, combined message is output from the outer split-merge block.
Things to Consider
When using split-merge blocks, keep in mind the following:
- A split-merge block has both "success" and "failure" output ports. However, you determine their functions by choosing whether, and where, to output messages to these ports.
- A split-merge block only ever outputs from one port or the other. If there are connections to both ports from within the block, the failure port takes precedence. That is, if a message enters the failure port, any message that reaches the success port does not output.
- If no workspace messages pass to either port, either by design or in runtime, the split-merge block always outputs a message from the success port to indicate that all jobs produced from actions inside the block were completed.
- You can connect an action inside a split-merge block directly to an outside action that is downstream of the block, instead of, or in addition to, the success or failure port of the block. However, you cannot connect an action upstream of the block directly to an action inside the block.
- You can disable a split-merge block as with any other component of an automation. When a split-merge block is disabled, none of the actions that comprise it runs. For more information, see To disable or re-enable components in a workflow.
To Combine Messages from Multiple Workspace Actions
- From the Create Automation page, expand the workspace palette icon .
- Drag and drop a gray Split-Merge Block icon onto the canvas.
- Use the handles on the block to drag it over Run a Workspace and/or Run a Dynamic Workspace actions that you want the block to comprise. Conversely, drag workspace actions inside the block as desired. Ensure that connections between workspace actions are maintained as desired.
- When the workspace actions inside the block are situated as desired, drag connections from one or both output ports of one or more upstream triggers or actions to the input port (>) of the block.
- From the input port of the split-merge block, drag connections to one or more workspace actions inside the block that you want to receive the message initially.
- To pass combined message(s) outside the block, drag connections from one or more workspace actions within the block to the success (✓) and/or failure (x) ports of the block. Typically, these actions are the final ones that comprise the message flow within the block.
- To pass combined message(s) to downstream components outside the split-merge block, drag connections from the success (✓) and/or failure (x) ports of the block to these components.