- Index

< Previous |  | Next >

# Creating a New EventFlow Module

In general, there are two ways to create a new EventFlow module file in StreamBase Studio:

- Create a new EventFlow fragment project, as described on Creating a New StreamBase Project. This creates and opens a new EventFlow module file named the same as the project.

- Create a new EventFlow module file in an existing project.

## Create a New, Empty EventFlow Module File

To create a new, empty EventFlow module in an existing project:

1. Start the New StreamBase EventFlow™ Module wizard using one of the following methods:

   - Select File → New → StreamBase EventFlow™ Module.

   - Click the drop-down arrow next to the New toolbar button (), and select StreamBase EventFlow™ Module from the drop-down menu:

   - Right-click anywhere in the Project Explorer, and select New → StreamBase EventFlow™ Module from the context menu.

   - With the cursor in any Studio view, press Ctrl+N (Windows) or command+N (Mac) to open the New dialog. Select StreamBase EventFlow™ Module and click Next.

   - With the cursor in any Studio view, press Alt+Shift+N (Windows) or command+option+N (Mac) to open the File → New menu at the cursor location. Select StreamBase EventFlow™ Module and press Enter.

2. In the New StreamBase EventFlow™ Module wizard, navigate to the package name folder of the project in which you want to add the module.

   (If you fail to select an existing package name, the module is created with the default package name. It is strongly discouraged to use the default package name.)

3. Type a name for the module file. Studio adds the `.sbapp` extension if you leave it off.

4. Click Finish. Studio creates the new file and opens it in the EventFlow Editor.

## Create an EventFlow Module from an Interface

To create a new EventFlow module that extends an existing EventFlow Interface:

1. Follow the steps in Create a New, Empty EventFlow Module File.

2. After step 3, select the Implement interfaces check box and click Next.

3. This opens a dialog that lets you select the name of an EventFlow Interface file, which must already exist. Click Add to see the EventFlow Interfaces defined in the current project.

4. Select an Interface file and click OK.

5. Click Finish.

## Create an EventFlow Module to Extend an Extension Point

To create a new EventFlow module that extends an existing EventFlow Extension Point:

1. Follow the steps in Create a New, Empty EventFlow Module File.

2. After step 3, select the Extend extension point check box and click Next.

3. In the Select Extension Point wizard panel, click Choose to see a list of extension points in the current project. Select an extension point and click OK.

4. Enter a name for the module to be extended by the selected extension point.

5. Click Finish.

Studio performs the following actions:

- Creates a new EventFlow module populated with the components defined in the Extension Point's interface.

- Adds the new module as a locally defined module instance in the Modules tab of the selected Extension Point.

The newly created module only contains the streams, Query Tables, constants, and schemas specified in the interface. You must complete the module to add the business logic for the module.

## Create an EventFlow Module by Linking

Advanced. For advanced use cases, it is possible to create a new StreamBase EventFlow module file in the selected project in your Studio workspace by linking to an existing file anywhere in the file system.

### Note

Do not use this linked file mechanism if your only goal is to share an EventFlow module between projects. Studio provides a much simpler way to share and reuse modules, as described in Project References and Importing Resources from One Module to Another. It is always better to import an external file into Studio than to link to an external file.

This feature establishes a true link, not a copy, of the specified EventFlow module file. When you link to a file that is outside the Studio workspace, any edits to the file in Studio affect the external file. Similarly, if you edit the original file outside of Studio, you are also editing the linked copy in the Studio workspace, possibly rendering the Interface invalid.

For the rare, advanced cases where it is appropriate to create a StreamBase EventFlow module by linking to an existing file, proceed as follows:

1. Follow the steps in Create a New, Empty EventFlow Module File.

2. Before you click Finish, click Advanced. This opens a new line in the dialog.

3. Select the Link to file in the file system check box, and use the Browse button to navigate to and select the existing StreamBase EventFlow module file of interest.

   Click Variables to insert path variables in the path to the linked file to avoid hard-coding an absolute path name. The path variables feature is provided by Eclipse, and is not part of StreamBase Studio. For guidance, see the Help topic Path Variables in the Eclipse Workbench User Guide.

4. Click Finish.

### Caution

In very advanced cases, it is possible to use both the Implement interfaces and Link to file options at the same time. In this case, the linked-to EventFlow module file must have already been implemented using the same Interface you select in the Choose Interfaces dialog. On creation of such a linked file, Studio typechecking reports any failures to conform to the selected Interfaces.