Importing Resources from One Module to Another

Module Imports Overview

You can import the following resources from another module into the current module:

The module imports feature allows you to re-use in the current module the constants and schemas defined in another module. In a large application, you can define commonly used schemas and constants in a central interface or module, and then import them as needed into other modules. This ensures that you define the schemas for streams and operators in the same way in all modules. If you edit the definition of a schema or if a constant changes in the central interface, those changes are automatically propagated into all modules that import that schema or constant.

The interface or module from which you can import schemas and constants must be in the current module's Maven resolution path. Thus, to be able to import schemas or constants from an interface or another module, make sure the interface or module of interest is declared as a Maven dependency of the current project.

Import schemas and constants into a module using the Definitions tab of the EventFlow Editor, or the Imports tab of the Interface Editor. The following illustration shows the Definitions tab of a module that imports resources from an Interface module named SharedSchemas.sbint, with the imported schemas shown separately from any schemas or constants declared directly in this module.

Hover the mouse over an imported module or interface's name to show the path of the originating Studio project, rooted at the Studio workspace.

Note

Any module parameters set in an imported module are not imported to the receiving module.

Edit Module Imports Dialog

In the Definitions tab of the EventFlow Editor, click the Add Import button to launch the Edit Module Import dialog. To see the same dialog, you can also:

  • Select an existing module name and click Edit.

  • Click anywhere in the Manage Module Imports grid, right-click, and select Add from the context menu.

  • Select an existing module name, right-click and select Edit from the context menu.

In the From drop-down list, select the module whose resources you want to import. If the drop-down list is empty, you must configure the module search path for the current module.

You can also use the Choose button to show you all modules in the module search path. Select a module and click OK.

When you have specified a module name, look through the importable items table. Make sure the module you specified actually contains the schemas or constants of interest.

The All importable items check box is selected by default to import all named schemas, table schemas, and constants from the selected module to the current module. In the following example, the dialog is configured to import all importable resources from SharedSchemas.sbint.

You can choose to add a prefix or suffix to the incoming name, to help distinguish imported schemas and constants from those natively defined in the current module. If you specify a prefix, suffix, or both, those strings are added to the names of all imported schemas and constants. You cannot specify a prefix or suffix for a subset of imported items. For example, if you specify Shared_ in the Prefix field, and StreamBase finds a named schema named NYSE_Feed in the specified module, that schema is renamed as Shared_NYSE_Feed in the current module.

To specify a subset of the available resources, select the Selected importable items check box, then select one or more schemas or constants in the table. In the following example, the dialog is configured to import only four named schemas from SharedSchemas.sbapp.

The Alias column shows the name that each imported schema or constant will have in the current module. The Alias column normally shows the same name for each item as in the Name column. Click to edit the default name in the Alias column, to specify another name for a schema or constant for use in the current module.

Back to Top