How to read server configuration from an embedded operator

How to read server configuration from an embedded operator

book

Article ID: KB0075731

calendar_today

Updated On:

Products Versions
TIBCO Streaming -

Description

How To: Reading server configuration from an embedded operator

Resolution

Get the container and operator name through the Operator API.

Many of the configuration settings are stored as Java system properties.

For more info on StreamBase Java Properties, see:
http://docs.streambase.com/latest/index.jsp?topic=/com.streambase.sb.ide.help/data/html/reference/javaproperties.html

Example:


To see this demonstrated create this test function (using the Java Function Wizard):
 
package com.sb.support;
public class SBInfo {
public static String SBuri() {
return System.getProperty("streambase.uri");
}
}


Call it from a Map operator as so:
 
calljava("com.sb.support.SBInfo","SBuri")


When this application is executed, the function output should look something like:
 
Time Output Stream Fields
10:13:53 OutputStream1 val=sb://localhost:10050/ Note(2)


A custom operator can call System.getProperty(String prop) to obtain this and other StreamBase configuration settings at runtime from within the application.


Note: If the Port is not explicitly specified in the sbd.sbconf using
 
<server>
<!-- Port to listen on. StreamBase defaults to 10000. -->
<param name="tcp-port" value="10050"/>
</server>

then the ":<portnum>" will be blank in the streambase.uri java property. In this case assume the default value of "10000".

Issue/Introduction

How to read server configuration from an embedded operator