Contents
Arcs are the lines that connect components on the EventFlow Editor canvas. Arcs indicate that the output tuples of one component flow to the input port of the next downstream component, and thus indicate the flow of tuples between and through operators as they pass from left to right through your application. Arcs also indicate the associations between operators and data constructs or modules.
There are two types of arcs:
-
Connection arcs — solid lines between operators with arrowheads indicating the direction of data flow.
-
Association arcs — gray dotted lines that associate operators with data constructs or modules that contain shared data constructs.
To draw an arc between two operators or between an operator and a stream:
-
Select the black square on the right (output) port of one component, and hold the mouse button.
-
Drag the mouse pointer to an input port on the left square port of another component.
-
Release the mouse button.
When you have successfully created the arc, a solid black line is shown between the components, and components downstream may change color to indicate their new typecheck status. The figure below shows six connected components: an input stream, two Map operators, a Filter operator, a Union operator, and an output stream.
|
Note
To display the blue type labels of components above their icons, enable the Show Component Types option in Studio Preferences.
To create an arc between a data construct and an operator that uses it:
-
Select the gray square on the bottom port of the operator, and hold the mouse button.
-
Drag the mouse pointer to the gray square at the top of its associated data construct.
-
Release the mouse button.
When you have successfully created the arc, a dotted gray line is shown between the
components. More than one operator can be connected to a single data construct. The
following figure, from the Query.sbapp application in
the operator sample, shows four Query operators
connected to one Query Table data construct.
|
As an alternative, you can use Studio's X X keyboard shortcut to automatically draw connection arcs between two or more selected components. The X X command can also draw automatic association arcs, if the number of Query operator and data construct components in the selection allows Studio to determine the associations without ambiguity.
See Keyboard Shortcuts for detailed instructions on using Studio's keyboard shortcuts.
You can disconnect an arc from one component's port and drag that end of the arc to an available port on a different component.
That is how you would insert a new component between two connected components. Let's say you have components A and C connected with an arc, and now you want to insert component B between them. To do so:
-
Delete the arc between A and C.
-
Drag component B between A and C.
-
Connect a new arc from A to B.
-
Connect a new arc from B to C.
-
You now have components A, B, and C connected in order.
There is a shortcut for the steps in the previous section if the component you want to insert between two others is a Filter, Map, Split, or Union operator. In this case:
-
Select the arc between the two connected components.
-
Right-click and select Insert Operator from the context menu.
-
From the secondary menu, select Filter, Map, Split, or Union.
-
The selected component is automatically connected with arcs to the components on either side.
|
Select an arc to display its properties in the Properties view. Selecting an arc between two operators or between an operator and a stream normally causes StreamBase Studio to display a read-only schema table in the Schema tab (shown below). The fields shown in the table represent the schema output from the previous operator or stream and the input to the next operator or stream. Under certain conditions, StreamBase Studio cannot determine which schema to use, and you may need resolve the ambiguity. (See Arcs in Loops for more.)
|
Selecting an arc between an operator and a data construct causes StreamBase Studio to display a read-only Association tab (shown below), that tells you about the association.
|
If your EventFlow contains an arc that creates a loop between two or more components, StreamBase Studio displays a typecheck error in the Typecheck Errors View and marks the downstream components gray, as shown in the figure below.
|
When components are in a loop, it is unclear to StreamBase Studio which schema should be used to typecheck them, because some schemas depend on other components that have not yet processed data. When this typecheck error occurs, select one of the arcs and open its Properties view. Then resolve the typecheck error in one of the following ways:
-
Define the schema by editing its fields in the table.
-
If the loop involves a Union operator (which by definition requires the schemas on all input ports to be the same), StreamBase Studio assists you with editing the schema. This is shown in the preceding figure. If you click the Use the schema link, StreamBase Studio fills the table with the first valid schema it detects (the schema associated with the first port, if all schemas are valid).
-
Click the button and insert an existing schema. You can choose a schema from any application within any project in the Package Explorer, or one previously saved in the Saved Schemas view.
When you select away from the Properties view (or when you click the
Apply
and Typecheck button near the top-right area of the Properties view), the typecheck
error associated with the loop should go away. Then the arc with the schema you
specified will turn blue, as shown in the figure below. If you later update a schema
that participates in the loop, the typecheck error reappears, and StreamBase
Studio provides an Update Using This Schema link in the Properties view when
you click the arc.
|
A subtler example of a loop occurs in the following EventFlow fragment:
|
When the loop condition is not obvious, use the clues that StreamBase provides. Typecheck error messages are often the best place to start. In this example, the Typecheck Errors view contains this message:
You have a loop involving update_tuple_count,tuple_count,grab_tuple_count.... Click on any arc within the loop to explicitly edit the schema.
A closer investigation of the application used in this example reveals that the loop condition is set up by the Lock and Unlock operators and their associated Lock Set data construct. The grab_tuple_count operator is attempting to process data within that flow, passing a result to the BSort operator. However, before the expected data can arrive, it is delayed at the Lock1 operator, awaiting some condition farther downstream to unlock the data.
As the error message suggests, the solution is to select the grab_tuple_count operator's output arc, and after determining what fields should be passed through, explicitly adding those fields to its schema.
