Referencing a Module

This topic explains how to reference one application module from another module. The procedure is either graphical or text-based, depending on whether the reference is in an EventFlow module.

Before You Begin

Both procedures in this topic assume that you have performed the prerequisite tasks outlined in Using Modules:

  • You have created an application module (or will use an existing module) that is compatible with the main application you reference it from.

  • The schema field names and types must be the same. The order of fields can be different.

  • The referencing module must be able to locate the referenced module in its module search path.

Referencing a Module

In an EventFlow, a module reference is represented as a single component that you insert onto the canvas. Just like any other component, it can be connected to other components and has properties that can be edited and typechecked.

  1. In the StreamBase Studio SB Authoring perspective, open the EventFlow module that contains the module reference.

  2. In the Editor tab, insert an application module in the EventFlow Editor canvas by using one of these methods:

    • Open the Module Explorer view, which shows all EventFlow modules in the current module search path. Select the module of interest and drag it to the canvas. This creates a new Module Reference for the selected module, with input and output ports already in place, based on the input and output streams of the selected module. The new Module Reference has a yellow background to indicate that its ports are not yet connected.

    • Drag an unconfigured Module Reference icon from the Palette view to the canvas. This opens a File Chooser dialog showing all EventFlow files in the module search path (essentially duplicating the Module Search Path view in the dialog). Select a module file, and a module reference is placed on the canvas.

      This method creates an unconfigured Module Reference on the canvas, that is associated with the selected module, but does not yet have input and output ports. Edit its properties and address those problems in the next steps.

  3. Open the Properties view for the new Module Reference, as described in Using the Module Reference Component. (Changing Module Reference properties does not change the module being referenced. Changes are local and only affect the referencing module.)

    If you dragged an icon from the Palette view, you must configure input and output port associations in the Input Ports and Output Ports tabs of the new Module Reference's Properties view.

  4. If the referenced application contains parameters, you may need to set or modify the parameter values, as described in Using Module Parameters.

  5. Draw arcs connecting the Module Reference's input and output ports to the appropriate components of the containing module.

  6. Save the module.

Viewing or Editing a Referenced Module

It is sometimes useful to look at a referenced module to see what it contains. You can view or modify the properties of an application module in two ways:

  • In the referencing module, select the Module Reference and press F3, or right-click and select Open Declaration from the context menu.

  • Find the module in the Project Explorer view and open it.