Dispatch Styles

Tuples are processed through an operator or module in first-come, first-served order. See Rules of StreamBase Execution Order for a more complete discussion of the rules.

But when there is more than one instance of the same operator or module, how are tuples routed to each instance? This question arises in the following cases:

  • When a single operator or module specifies a Multiplicity setting of two or more, which causes that number of instances of the operator or module to be instantiated.

  • When an Extension Point operator hosts two or more instances of modules that implement the interface referenced by that Extension Point.

In these cases, StreamBase's default behavior, called Broadcast, is to send each incoming tuple to each instance of the operator or module. You can optionally specify non-default styles for dispatching incoming tuples to operator or module instances.

For certain cases, the tuple dispatch style can be specified independently for each input stream. This applies to:

  • Module References where the referenced module has more than one input stream.

  • Extension Points.

  • Operators with more than one input stream, including Join, Gather, Merge, and Pattern.

StreamBase offers the following dispatch styles for routing tuples to multiple operator or module instances:

Broadcast

Broadcast is the default dispatch style for both EventFlow and StreamSQL applications. This style sends each incoming tuple to all operator or module instances.

Numeric

Specify the Numeric dispatch style for multiple instances of operators and modules, but not for Extension Point modules. This style routes incoming tuples to one of the several multiple operator or module instances, based on the result of evaluating a dispatch expression. When you specify the Numeric dispatch style, you must also specify a Dispatch Expression that resolves to an int. (Use the hash() function to turn other data types into integers.) The expression result is divided by the number of instances, and the remainder determines which instance the tuple goes to.

Round Robin

Specify the Round Robin dispatch style for multiple instances of operators and modules, but not for Extension Point modules. This style routes each incoming tuple to each instance of a multiple operator or module in turn. The first tuple goes to the first operator or module instance. The next tuple is routed to the next operator or module instance in the list, and so on in round robin sequence among all multiple instances.

(In previous StreamBase releases, the Round Robin dispatch style was the default if you did not specify a key expression as part of the data parallelism options in the Concurrency tab of the Properties view.)

Name

Specify the Name dispatch style only for module instances of an Extension Point operator. Module instances of an Extension Point are each assigned a module identifier in one of two places:

  • In the Name column of the Modules tab of the Extension Point operator's Properties view.

  • In the name attribute of an <extension> element in a StreamBase deployment file.

The Name dispatch style routes each incoming tuple to the Extension Point's module instance whose name is equal to the result of evaluating the Dispatch Expression for the relevant input stream. When you specify the Name dispatch style, you must also specify a Dispatch Expression that resolves to one of the Names on the Modules tab or in a StreamBase deployment file.

Back to Top ^