Using the Split Operator

Introduction

  The Split operator splits its incoming stream into two or more outgoing streams that run in a guaranteed specific order. Each incoming tuple is sent first to output port 1, then to output port 2, and so on.

By contrast, you can also split the path of execution by drawing multiple arcs from an operator's output ports, as shown in the following illustration.

However, in this case, the order in which tuples proceed out the multiple arcs is not known and is not guaranteed. By using a Split operator, you can obtain guaranteed processing order.

In the example above, an inbound tuple is first sent to the downstream components connected to the Split operator's Output port #1, the top port. After the processing of that tuple completes on the top path, an exact copy of the inbound tuple is sent out the Split operator's Output port #2 to the bottom path.

How does the Split operator know that a tuple has completed processing along the top path before sending the same tuple out the bottom path? The Split operator does not track the processing undergone by a tuple after it leaves its output ports, and it does not wait for a return value in any way. The processing sequence is guaranteed because, when StreamBase Server compiles the EventFlow application into executable code, it does so in the order in which components are organized in the canvas, and in the order of output port numbers of the Split operator.

The diagram above has red numbers to indicate the processing order of each component. When the server runs this compiled application, it encounters steps 2 and 6 in the Split operator. The server executes in the order 2, 3, 4, and 5 before returning to step 6 and beyond.

Properties: General Tab

Name: Use this required field to specify or change the name of this instance of this component. The name must be unique within the current EventFlow module. The name can contain alphanumeric characters, underscores, and escaped special characters. Special characters can be escaped as described in Identifier Naming Rules. The first character must be alphabetic or an underscore.

Enable Error Output Port: Select this checkbox to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports to learn about Error Ports.

Description: Optionally, enter text to briefly describe the purpose and function of the component. In the EventFlow Editor canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Properties: Split Settings Tab

Use the Split Settings tab to specify the number of output ports, which correspond to the number of downstream paths that will receive a copy of the tuple in sequence, as in output port number order. Once the output ports are set up, you can then draw an arc from the Split operator's Output port #1 (top port) to the intended downstream path that should receive the tuple first. Then connect the Split operator's Output port #2 to the downstream path that should receive the same tuple second, after the first copy of the tuple was processed to completion. As needed, continue making the connections (in sequence) for each output port and the intended downstream path.

Tip

To easily view the output port numbers, make sure tooltips are enabled, as described in Authoring Panel. This is especially helpful when you have many output ports and want to be sure you are connecting the arcs as intended. The following illustration shows the cursor is hovering over the top output port on the right side of the Split operator:

Properties: Concurrency Tab

Use the Concurrency tab to specify the use of parallel regions for this instance of this component. Consider selecting the parallel regions check box if this component instance is long-running or compute-intensive, can run without data dependencies on other StreamBase components, and would not cause the containing module to block while waiting for a thread to return. In this case, you may be able to improve performance by selecting this option. This option directs StreamBase Server to process this component concurrently with other processing in the application. The operating systems supported by StreamBase automatically distribute the processing of threads across multiple processors.

Caution

The parallel regions setting is not suitable for every application, and using this setting requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.