A StreamBase module can be referenced by one or more modules. The referenced module is called an application module, to distinguish it from the main, top-level application that references it. Developing with modules enables you to avoid replicating code by reusing the same functionality in multiple applications.
Following is a general workflow for working with application modules. Follow the links to other topics for details on each step:
-
Create a new application module or use an existing application as a module. In either case, the application module's functionality and the data that it uses should be compatible with the applications that will reference it. The methods for creating EventFlow applications and StreamSQL applications are different:
-
Create a new EventFlow module by selecting → → .
You can also use an existing application as a module. If you want to reuse only a subset of functions in an existing module, you can create a new module application by extracting the components you want. See Extracting a Module for details.
-
To create a new StreamSQL application module, click → → . You cannot extract StreamSQL module graphically from an existing application.
-
-
Decide whether to make your new or extracted module hygienic or flexible, as described in Hygienic Modules.
-
Optionally define parameters for your application and use the parameters in expressions in its operators. See Using Module Parameters for details. You must also bind a value to each parameter, either in the module, or later in a Module Reference to this application. The parameters are replaced by the values at run time.
-
Ensure that the main application is able to locate the module:
-
If you keep modules in a subfolder of the primary Studio project folder, make sure the subfolders are on the module search path.
-
To re-use modules from one Studio project to another, use project references to make resources in project B available for import in project A.
-
In rare cases, you may need to use modules or resources that are not visible in the Package Explorer view (that is, they are outside of your Studio workspace). In this case, you can either import the modules or resources into the current project, or add search paths to those external resources in your project's server configuration file, usually named
sbd.sbconf, as described in Managing Resource Files in Studio.
-
-
In the primary application, reference the module as described in Referencing a Module.
-
If the referenced application contains parameters, you can set their values in the module reference, as described in Using Module Parameters. This overrides any values previously set in the referenced application.
-
If your application references a module that contains tables, your application can query that data, as described in Using Module Parameters.
-
When you are ready to deploy an application that contains module references, configure it to run outside of StreamBase Studio, as described in Deploying Applications.
Note
When you reuse a module in multiple applications, remember that changes to the module itself are inherited in every module reference to it. Conversely, changing the properties of an individual module reference does not change the module or any other applications that reference it.
Details about application modules are covered in these topics:
