- Index

< Previous |  | Next >

# StreamBase Configuration Files

## Add a Port-Setting Configuration File

The default Run Configuration for EventFlow launches in StreamBase Studio sets the StreamBase Client API listening port for the fragment being launched in the following order:

- A port set in a configuration file, if any

- The StreamBase default port of 10000, if available

- If 10000 is in use, any available port over 1024

This sequence allows you to run several instances of the same EventFlow fragment at the same time without a port conflict.

However, this port-setting sequence is not carried over when you deploy the same EventFlow fragment on the command line. For this reason, TIBCO recommends using a configuration file that sets the StreamBase listening port to zero. The zero setting tells the StreamBase Runtime to select any available port over 1024. If you include this configuration in your Studio project, the behavior of multiple launches in Studio remains largely the same. At the same time, running multiple launches on the command line can now proceed without port conflicts.

Follow these steps:

1. Select the `src/main/configurations` folder for the `firstapp` project in the Project Explorer view.

2. Right-click and select New → StreamBase HOCON Configuration File from the context menu.

3. This opens the New StreamBase HOCON Configuration File dialog, with your project's `src/main/configurations` folder already selected. In the name field, enter `sbportzero` to name the file. (Studio automatically adds the required `.conf` extension.)

4. In the Options field, enter `listener` to narrow the list of HOCON file types.

5. Select EventFlow Client API Listener.

6. Clear the check box for the Generate sample values option.

7. Click Finish. This opens the HOCON Editor with a template file filled in.

8. Fill in the file to match the following settings:

       name    = sbportzero
       version = 1.0.0
       type    = com.tibco.ep.streambase.configuration.sbclientapilistener

       configuration = {
         ClientAPIListener {
           apiListenerAddress = {
             portNumber = 0
           }
         }
       }

9. Save the file and close the HOCON Editor.

The following sections introduce HOCON configuration files in more detail.

## Overview of HOCON Files

Configuration files for TIBCO StreamBase use HOCON syntax. HOCON is a superset of JSON, enhanced for readability. HOCON (Human-Optimized Configuration Object Notation) is a standard with a published specification. StreamBase HOCON departs from standard HOCON in several ways described on HOCON Syntax Reference.

StreamBase HOCON files have a type, which must be specified in a header line at the top of the file. Each type specifies configuration for a particular aspect of StreamBase. There are HOCON file types that configure StreamBase Runtime applications and nodes, and there are file types that configure aspects of running EventFlow or Live Datamart fragments.

See the HOCON Configuration Guide for the details of each HOCON configuration file type.

## Placement of HOCON Files

HOCON files must use the `.conf` filename extension. Use any basename that reminds you of the file's contents.

When StreamBase Studio creates a new StreamBase project, or migrates a project from a legacy format, it creates default template configuration files for most project types:

- EventFlow fragment projects: no configuration files created by default.

- LiveView fragment projects: `engine.conf` in `src/main/configurations`.

- Java for Transactional Memory projects: `engine.conf` in `src/main/configurations`.

- StreamBase Application projects:

  `app.conf` in `src/main/configurations`
  `node.conf` in `src/test/configurations`

These configuration filenames are traditional, but not required.

Place one or more HOCON configuration files in the `src/main/configurations` folder of your Studio project. Each file is distinguished by the combination of name, version, and type lines required in the header at the top of each file. As long as these three lines are unique in a project's `src/main/configurations` folder, there is no confusion between two or more files.

## HOCON Editor in Studio

StreamBase Studio provides an integrated HOCON Configuration Editor that is invoked when you double-click on a file with `.conf` extension in your Studio project folder, or when you invoke File → New → StreamBase HOCON Configuration File.

The HOCON Editor provides syntax coloring, validation of the HOCON format, and suggestions for valid entries invoked with Ctrl+Space.

## Adapter Configuration Files

There is one exception to the use of HOCON format for configuration files. Certain adapters are specified with XML files whose top-level element is `<adapter-configurations>`. Place these adapter configuration files in your project's `src/main/resources` folder. See Adapter Configuration Files.