Tervela Subscribing Input Adapter

This adapter is deprecated in this release. The adapter does not appear in the Adapters, Java Operators list in StreamBase Studio unless you enable Show deprecated Global Operators/Adapters option in Studio Preferences.


The TIBCO StreamBase® Input Adapter for Tervela allows a StreamBase application to receive messages published to one or more Tervela topics. The adapter is embedded in the StreamBase application and has two output ports: one that emits status tuples, and a second that emits tuples representing received Tervela messages.

The adapter subscribes to one or more topics during startup and asynchronously and continuously receives and converts incoming Tervela messages into StreamBase tuples, which it sends downstream.

The adapter supports all StreamBase data types, including tuples and lists, although lists may not contain elements of type list. The schema of the Tervela message output port is set through the Edit Schema tab of the adapter's Properties view.

The adapter is configured through several properties set in the adapter's Properties view in StreamBase Studio. The properties include parameters used to connect to the Tervela server and the set of topics to subscribe to at startup.

Adapter Properties

Property Description
Username The username to use in logging in to the Tervela server.
Password The password to use in logging in to the Tervela server.
TMX Address 1 The host name or IP address of the primary TMX in a fault-tolerant pair.
TMX Address 2 The host name or IP address of the secondary TMX in a fault-tolerant pair, or blank if the primary TMX is not part of a fault-tolerant pair.
Topic(s) One or more topics to subscribe to at startup. Separate multiple topics with spaces. For example, "top.topic1 top.topic2". Use an asterisk wildcard to subscribe to all topics at a given level. For example, "top.*".
Topic Field Name The name of the output stream field to receive the topic value from the published Tervela message.
Find Fields By ID If enabled, the adapter tries to map a Tervela message field to a StreamBase field by field ID. A Tervela field with an ID of 123 would match a StreamBase field named _123. If no ID match is found, the adapter uses its default field mapping mechanism, using the Tervela field name to find the StreamBase field.
Login Timeout The time in milliseconds to wait when attempting log in.
Reorder Timeout The time in milliseconds to wait to receive an out-of-order message (for re-ordering), or zero to discard late messages automatically.
Report Missing Tuple Fields If enabled, the adapter emits a warning and a status tuple when a Tervela message field has no corresponding field in the output schema.
Log Level Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level is used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE.

Using the Adapter in a StreamBase Application

This section discusses how to use the Tervela Subscribing Input Adapter in a StreamBase application. As shown in the diagram below (depicting the adapter's sample application), the subscribing adapter has one input port and two output ports to communicate with the surrounding application.

The Tervela Subscribing Input Adapter's ports are used as follows:

  • Input port, Subscribe: This input port receives tuples used to subscribe to, or unsubscribe from, topics after the adapter has started. In addition, it can be used to query the set of active subscriptions. The Subscribe port has the following schema:

    • Topic, string: Contains the topic to subscribe to or unsubscribe from.

    • Subscribe, bool: true or false to subscribe or unsubscribe, respectively.

    If both the topic and subscribe fields are null, the tuple is taken as a query request, and the adapter emits a tuple on its status port containing the active set of subscriptions.

  • Output port 1, Status: This output port emits status, information, and error tuples. The Status port has the following schema:

    • type, string: Contains one of the following values describing the type of event that occurred:

      • Login

      • Process Tervela Message

      • Process Tuple

      • Suspend/Resume

      • Subscribe

      • Notification

    • object, string: the name of the object associated with the event, such as the address of the TMX being logged into, the contents of the Tervela message that wasn't processed successfully, or the name of the adapter that was suspended or resumed.

    • action, string: the action associated with the event, such as a login succeeding or adapter suspended/resumed.

    • message, string: A human-readable message string

  • Output port 2, Tervela Messages: The adapter emits a tuple on its second output port for each Tervela message received. The port's schema is derived from the Edit Schema tab of the adapter's Properties view and can contain all StreamBase data types, including lists and (nested) tuples to accommodate hierarchy in Tervela messages. Tervela message fields are mapped to tuple fields by case-sensitive name. List fields may contain all StreamBase types except list types. StreamBase list fields are used to capture Tervela array fields in the Tervela message. Fields not present in a Tervela message are sent as null in the tuple.

    In processing incoming Tervela messages, the adapter converts Tervela data types to StreamBase data types. Not all possible conversions are valid. When an attempt to perform an invalid conversion occurs, a status tuple indicating the nature of the error is emitted, and the Tervela message is discarded. The following table shows the set of valid conversions.

    Tervela Type StreamBase Type
    BOOLEAN bool
    BOOLEAN_ARRAY list<bool>
    BYTE int
    BYTE_ARRAY blob
    DATETIME timestamp
    DATETIME_ARRAY list<timestamp>
    DOUBLE double
    DOUBLE_ARRAY list<double>
    FLOAT double
    FLOAT_ARRAY list<double>
    INTEGER int
    INTEGER_ARRAY list<int>
    LONG long
    LONG_ARRAY list<long>
    PRECISION_LONG tuple{value: long, precision: int}
    PRECISION_LONG_ARRAY list<tuple{value: long, precision: int}>
    SHORT int
    SHORT_ARRAY list<int>
    STRING string
    STRING_ARRAY list<string>

Add an instance of the adapter to a new StreamBase application as follows:

  1. In StreamBase Studio, create a project, and create an EventFlow application file to host the adapter.

  2. Drag an instance of the Tervela Input Adapter from the Operators and Adapter drawer in the Palette view to the canvas.

  3. Connect an input stream to the adapter's input port and configure the stream's schema with fields named topic and subscribe of types string and bool, respectively.

  4. Connect output streams to the adapter's two output ports.

  5. Configure the schema of the Tervela message output stream (port 2) using the Edit Schema tab of the adapter's Properties view to match the set of fields expected in the incoming Tervela messages.

  6. Select the adapter icon, and in the Properties view, select Adapter Settings and fill in any desired properties. Username, Password, and TMX Address 1 are the only required properties.

Typechecking and Error Handling

The Tervela Subscribing Input adapter uses typecheck messages to help you configure the adapter in your StreamBase application. In particular, the adapter generates typecheck messages when no username or TMX address is specified, when two TMX addresses are provided that resolve to the same IP address, when the subscribe input string is not configured correctly, or when the configured topic field is not present in the output schema or is not of type string.

The adapter generates messages on the status port during runtime under various conditions, including:

  • The adapter creates or fails to log in to the TMX server.

  • An error occurs in processing an incoming Tervela message.

  • The adapter is suspended or resumed.

Suspend and Resume Behavior

When suspended, the Tervela Subscribing Input Adapter stops emitting tuples on its output ports.

When resumed, the adapter begins emitting tuples on its output ports once again.