A StreamBase interface is a contract to which the behavior of a module can adhere. An interface is a set of definitions of input streams, output streams, Query Tables, constants, named schemas, and table schemas. An interface can consist of only schema definitions, or of any combination of streams, tables, and schemas. Streams must be defined with named schemas, while tables must be defined with table schemas.
Interfaces are used in two ways:
As templates to enforce strict compliance with its definitions in new and existing EventFlow modules that implement and extend the interface.
In conjunction with an Extension Point operator that references an interface and hosts one or more module instances that implement that interface.
This page discusses interfaces in general and discusses the use of interfaces as templates for modules. See Using Interfaces with Extension Points to learn about using interfaces with Extension Points.
StreamBase interfaces are stored as files with the
.sbint extension in your Studio project folders. Interfaces are
created and edited with the Interface Editor. Open the Interface Editor in one of the following ways:
Create a new interface from scratch with Creating a New EventFlow Interface.> > , as described on
.sbintfile from the Project Explorer to the canvas.
.sbintfile in the Project Explorer.
.sbintfile in the Module Explorer.
For interfaces referenced by an Extension Point operator:
Select the operator and press F3, or select from the context menu.
Open the Modules tab of the Properties view for the operator and click the Interface link.
By contrast, the following actions that you might expect to open the Interface Editor do not:
.sbintfile from the Module Explorer to the canvas creates an Extension Point operator that references the dragged interface.
.sbintfile in the StreamBase Extension Points view or Module Call Hierarchy view does not directly open the Interface Editor. Instead, double-clicking in these views opens the EventFlow Editor for the module that contains the Extension Point operator that references that interface, with that Extension Point operator selected in the canvas. To continue on to the Interface Editor, press F3.
When a module implements an interface, the interface enforces compliance with the stream and table definitions in the interface. Since an interface's stream and table definitions must be based on named schemas and table schemas, using an interface also enforces the use of centrally defined schemas throughout your application.
This lets you design an interface with a known set of streams, tables, and schemas
that many modules can implement in different ways. For example, an interface named
Multiply might define a set of input and output streams
with certain schemas. You can then create several modules such as
implement that interface and add the actual multiplication logic. Any module that
implements an interface can be invoked interchangeably with another module that
implements the same interface.
Interfaces can implement other interfaces. This lets you nest a set of definitions in layers and use them in the combinations most appropriate for your applications. For example, interface A can consist of only schema definitions. Interface B can then define input and output streams, extending and importing from interface A for its schema definitions. Then interface C could define a set of Query Table placeholders, extending and importing from interface B, and so on.
Create a new EventFlow module based on an interface with these steps:
If your interface does not yet exist, use Create a New, Empty Interface File to create a new interface. Define the set of schemas, streams, and tables for the interface and save the> > as described in
Create a new, blank EventFlow application module with Create an EventFlow Module from an Interface, specifying the interface file with the Implement interface check box.> > as described in
Create a new interface that extends an existing interface using the steps described in Create an Interface from an Interface.
Add an interface to an existing EventFlow application module with these steps:
Make sure the interface you want to add exists in the module search path of the module's project.
Open the EventFlow Editor for the module of interest, and open the Definitions tab.
In the Manage Interfaces panel at the bottom of the tab, select .
In the Choose Interfaces dialog, select the interface file of interest and press.
Studio adds the interface and opens the Editor tab of the EventFlow Editor. Notice that Studio has added a stream and Query Table component to the module's canvas for each stream and table definition in the interface.
Continue editing the module, connecting the newly added streams or tables to other components in the module.
You might base a module on an interface definition and then later find yourself inadvertently removing one or more stream or table components that were based on the interface. Studio reports this as a typecheck error, and places a banner line across the top of the canvas like the following example:
To correct this condition, open the Definitions tab of the EventFlow Editor. In the Manage Interfaces panel at the bottom, select the name of the interface as reported in the error message, and click .
This opens the Add Missing Items dialog. Select the check box for one or more missing components and click.