- Index

< Previous |  | Next >

# StreamBase and LiveView URIs

## What Port Am I Using?

If you run multiple EventFlow fragments in StreamBase Studio, or if you explicitly specify using Any available for the listening port in a Run Configuration, the fragment launches but you may not know what StreamBase port each fragment is using.

To determine the StreamBase listening ports in use, run this epadmin command:

    epadmin display services --servicetype=eventflow

This returns three lines of information about each running fragment, with the StreamBase URI on the last line. For example:

    Service Name = eventflow.com_tibco_sb_sample_bestbidsandasks_BestBidsAsks0_BestBidsAsks.sbuser
    Service Type = eventflow
    Network Address = sb://Graemsay.local:13596

Similarly, to determine the LiveView ports in use, use the `liveview` service type:

    epadmin display services --servicetype=liveview

This returns:

    Service Name = liveview.liveview0.sample_lv_sample_helloliveview.sbuser
    Service Type = liveview
    Network Address = sb://Graemsay.local:10000 lv://Graemsay.local:10080

In this case, the third line shows the URI of the StreamBase server that is running the LiveView application itself, as well as the LiveView URI.

On a busy subnet with many nodes running, the output of these commands can be more than you want to see. To narrow the results to the nodes running on a single machine, use grep on macOS and Linux or the find or findstr commands on Windows to narrow the results based on the machine name of interest. For example, a command like the following:

    epadmin display services servicetype=eventflow | grep Graemsay

might return these results:

    Network Address = sb://Graemsay.local:46279
    Network Address = sb://Graemsay.local:43254
    Network Address = sb://Graemsay.local:11493
    Network Address = sb://Graemsay.local:62475

## Introduction to StreamBase URIs

When using an epadmin command to connect to a running EventFlow fragment's ports, you only need to know the the node's admin port, or its node name.

However, when using a legacy client access command such as sbc, or when using the StreamBase Client API, you must know the StreamBase URI in the form `sb://hostname:port`, where the default hostname and port are `sb://localhost:10000`. For access to an TLS-enabled StreamBase server, clients must use `sbs://hostname:port`.

For example, the StreamBase client command sbc with its list option returns a report of the StreamBase objects in the running fragment. For example:

    sbc -u sb://sbserver.example.com/nnnnn list

If the machine hosting the server is the current machine, only the port needs to be specified:

    sbc -p nnnnn list

If the machine is `localhost`, and the port number is the traditional default, 10000, then neither host nor port need to be stated. Thus:

    sbc list

## Introduction to LiveView URIs

A running LiveView server uses two ports: one for the StreamBase server that is running the LiveView application itself, and the second port for the LiveView URI. The default port for a LiveView server's StreamBase server instance is 10000, while the default LiveView port is 10080. For a security-enabled LiveView server, the default port is 10443.

The primary method for accessing a running LiveView server is through its embedded web server using a standard browser. For a LiveView server running on the default port, point your browser to, for example, `http://localhost:10080`. When a LiveView project is configured to provide access to a custom JavaScript interface, access the server with a URL such as `http://localhost:10080/`customname``. If your LiveView project is configured to provide access to TIBCO LiveView Web™ clients, access those servers with a URL like `http://localhost:10080/lvweb`. In either case, use `https` and the 10443 port for security-enabled LiveView servers.

If you are running multiple LiveView server instances, each instance must have its own port. Determine the ports in use as described in What Port Am I Using? above.

When using TIBCO LiveView Desktop™ or the LiveView Client API, you must use a LiveView URI in the form `lv://hostname:port`, where the default hostname and port are `lv://localhost:10080`. When connecting to an TLS-enabled LiveView server, clients must use `lvs://hostname:port`, where the default security-enabled port is 10443.

## Setting the StreamBase Port in Studio

You can edit the Run Configuration for EventFlow fragments to specify using a particular listener port.

There is a chicken and egg problem here. You must run the fragment at least once with default settings in order to create and store a Run Configuration. When that is done, open the Run Configuration for the fragment you just ran with Run → Run Configurations from Studio's top-level menu (or by using the drop-down menu to the right of the Run button in the Studio toolbar).

In the Run Configurations dialog, open EventFlow Fragment in the contents panel on the left, and select the name of the EventFlow module you just ran. The Main tab of that module's run configuration shows the port selection options.

StreamBase engine port

  This control specifies the Client API listening port for the StreamBase server instance that runs as part of every EventFlow fragment launch. Choose one of the following options:

  Configuration or default

    This control specifies that the StreamBase listening port is assigned by a configuration file of type `sbclientapilistener` in the project's `src/main/configurations` folder. If no configuration file sets the StreamBase port for this project, then the default value of 10000 is used. If port 10000 is in use, a random unused port is assigned.

  Any available

    Select this control to specify any port not currently in use. This control is the same for Studio as setting `portNumber = 0` in a configuration file.

  Specified

    Select this control to specify a particular port number for this EventFlow fragment's StreamBase server.

Learn more about using the Run Configurations dialog on Editing EventFlow Run Configurations.

## Setting the StreamBase Port with Configuration

You can use a HOCON configuration file to specify a StreamBase listening port. Create such a configuration file using Studio's StreamBase HOCON Configuration Editor, and save the file to the `src/main/configurations` folder of your Studio project. The port specification is then used when the fragment is both by Studio (with the Configuration or default option selected) and when run with epadmin as part of running a StreamBase Application archive.

Specify a HOCON configuration file of type sbclientapilistener. The following shows an example of such a file that sets the listener port to an explicit value of zero, which tells the Runtime to use any available port over 1024:

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

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

The following version sets the listener port to the value of a variable named SBPORT with a default value of 10011. You must specify a default value when specifying variable names.

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

    configuration = {
      ClientAPIListener {
        apiListenerAddress = {
          portNumber = ${SBPORT:-10011}
        }
      }
    }

You then specify a value for SBPORT on the epadmin node install command line using the `substitutions` parameter as shown in the following example. (This command is shown on multiple lines, but must be entered as one long command.)

    epadmin install node
      --application=target/deploy_firstapp-0.0.1-SNAPSHOT-ep-application.zip
      --nodename=B.sbuser --nodedirectory=~/tmp/Nodedirs
      --substitutions="SBPORT=10025"

If you use a port-setting configuration file with a default value, and then forget to include the `substitutions` parameter, the fragment loads using the default port.

## Determining the StreamBase Port in Studio

Studio reports the StreamBase listening port in four locations:

1. In the blue information bar

  When an EventFlow top-level module was successfully launched, it reports its status in a blue information bar across the upper left corner of the canvas. The full StreamBase URI is reported in this message, including the current port in use. If the server is running on the default port 10000, the port number is not shown. If the information bar is closed, hover over the blue `i` icon to see the URI.

  The StreamBase URI is reported only when a single instance of the same fragment is running.

2. In the Clusters view

  In the Clusters and Nodes pane on the left, select the Engine line for the currently running node. On the right, look for EventFlow Fragment Client URI, which shows the full URI including port number.

3. When hovering over the Running icon

  The Running icon is in the lower left corner of the Studio window, and shows a green arrowhead when a fragment is running. Hover the cursor over this icon to see a brief report that includes the StreamBase URI with port. If there are multiple fragments running, the hover text shows all fragments and their URIs.

4. In the Console view log

  One of the information lines shown in the Console view for a successful fragment launch reports the status of the StreamBaseHTTPServer subsystem. Immediately following is the hostname and listening port.

The following image shows the approximate location in the SB Test/Debug perspective of the four reporting locations, numbered as in the list above.

## Setting the LiveView Ports

The methods of setting and determining the client API listening port for LiveView servers are analogous to the methods for StreamBase servers described in the previous sections.

Setting the LiveView Port in Studio

  Edit the Run Configuration for a LiveView fragment to specify using a particular pair of ports. For LiveView fragments, you can independently set the port for the StreamBase server that underlies and supports LiveView, and the port for the LiveView server itself.

  See the description of the Main tab of the Run Configurations dialog for LiveView servers.

  ### Note

  LiveView fragment ports do NOT auto-select random ports if the configured or default ports (10000 and 10080) are in use. To run two or more LiveView fragments at the same time in Studio or with epadmin, you must configure the second and subsequent fragments to use either the Any available or Specified options.

Setting the LiveView Port with Configuration

  Specify a HOCON configuration file of type ldmclientapilistener. The following shows an example of such a file that sets the listener port to an explicit value of 10088:

      name = "ldmport"
      version = "1.0.0"
      type = "com.tibco.ep.ldm.configuration.ldmclientapilistener"

      configuration = {
        ClientAPIListener = {
          portNumber = 10088
        }
      }

  You can use a substitution variable for the port number as described in Setting the StreamBase Port with Configuration and in Substitution Variables. The ldmclientapilistener configuration type is described in Live Datamart Client API Listener Configuration.

Determining the LiveView port in Studio

  Studio reports the LiveView listening port in two locations:

  1. In the Clusters view

    In the Clusters and Nodes pane on the left, select the Engine line for the currently installed and started node. On the right, look for LiveView Fragment Client URI, which shows the full URI, including port number.

  2. In the Console view log

    One of the information lines shown in the Console view for a successful fragment launch reports a line such as "LiveView Web service listening on non-SSL port 10080".