Contents
This page discusses interfaces as used with the Extension Point operator. See StreamBase Interfaces for a general overview of StreamBase interfaces, and for interfaces used as templates for new and existing application modules.
The Extension Point operator is like a Module Reference for interfaces. In the same way that a Module Reference provides input and output ports for sending the flow of tuples into a referenced module, the Extension Point operator references an interface, and provides input and output ports for sending the flow of tuples into one or more modules that implement that interface. An Extension Point operator hosts one or more module instances that implement the interface referenced by that operator. Each module instance is assigned a name to be used when uniquely addressing an individual module instance.
Add an Extension Point operator to an EventFlow application module in one of the following ways:
-
Locate an interface definition file with
.sbint
extension in the Module Explorer and drag it to the canvas. -
Drag an Extension Point operator token from the Operators and Adapters drawer of the Palette view to the canvas. In this case, Studio opens a File Chooser dialog from which you can select an interface file from those in the current module search path, or optionally, from the entire Studio workspace.
You can also skip the File Chooser dialog and instead open the Modules tab of the Properties view for the new operator to specify the interface file that this operator will reference.
See Using the Extension Point Operator for details on the Property view settings for the operator.
Like modules, interfaces can be either non-hygienic or hygienic. Non-hygienic interfaces can tolerate extraneous fields as long as fields they define match or are coercible. Hygienic interfaces are strict, and do not typecheck if modules that implement them:
-
Expect fields having non-coercible data types
-
Expect fields that the interface does not declare
-
Do not expect the fields the interface does declare
Similar rules apply to matching schemas defined by interfaces as to matching schemas between streams. For more information, see Non-Hygienic and Hygienic Modules.
When modules are listed as module instances for an Extension Point operator, incoming tuples are routed to those modules according to the dispatch style for each of the operator's incoming streams, as specified on the Concurrency tab of the Properties view for the operator. Two dispatch styles are available for the input streams of an Extension Point:
-
Broadcast. Send incoming tuples in parallel to all module instances of the Extension Point operator.
-
Name. Route incoming tuples to one of the operator's module instances by module name. The name value used for each tuple is the result of evaluating the Extension Point dispatch expression for the input stream on which the tuple arrives.
You can specify dispatch styles independently for each input stream of an Extension Point operator. Tuples are dispatched the same when the Extension Point operator specifies its modules locally or externally.
See Using the Extension Point Operator, Concurrency Options, and Dispatch Styles for further information.
For use with an Extension Point operator, StreamBase supports interfaces that define a Placeholder Query Table, but cannot support interfaces that define a Shared Query Table.
A Placeholder Query Table in an interface stands in for a real Query Table defined outside the implementing module. By contrast, a Shared Query Table in an interface defines a table that the implementing module must provide, and is accessed externally from the module.
Shared Query Tables are actual Query Table objects that can be accessed by more than one module. Remember that an Extension Point operator can be implemented by two or more module instances that implement the same interface. If an interface could include a Shared Query Table, then each module instance would need access to a copy of the same Shared Query Table at runtime. But the number of module instances that implement an extension point interface is not discoverable at design time, only at runtime. So no Query operator could be designed to know in advance which copy of the same Shared Query Table would be correct for a given query instance.
You are free to define Shared Query Tables in an interface that is used as a template instead of an extension point.