TIBCO FTL Publishing Output Adapter

Introduction

The TIBCO StreamBase® Output Adapter for TIBCO FTL® allows a StreamBase application to publish FTL messages. The adapter is embedded in the StreamBase application and has two input ports and one output port. The first input port is used to connect to, and disconnect from, the FTL realm server. The second input port is used to enqueue tuples to the adapter containing FTL messages to be published. The output port emits status tuples.

The adapter supports a subset of StreamBase data types that contains tuples and lists, though lists may not contain elements of type list. Tuple fields of type tuple can be used to send nested FTL messages.

The adapter is configured through several properties set its Properties view in StreamBase Studio. The properties include parameters used to connect to the realm server, and the application and the endpoint names.

TIBCO Middleware Dependencies

This adapter requires access to the JAR file that implements the TIBCO FTL Java API on your system, and any files referenced by that JAR file. The adapter was tested with FTL version 3.1, and is compatible with higher versions as well (such as 5.0 and higher including 6.x). To make the TIBCO FTL Java API available to the adapter, you must supply a maven dependency for it. The FTL sample comes with a launch config which will install the tibftl.jar into your local maven repository.

The tibftl.jar file, in turn, relies on various native libraries, such as tibftljni.dll on Windows and tibftljni.so on Linux. As with tibftl.jar, these native libraries are supplied as part of your TIBCO FTL installation and are not shipped with StreamBase. Make sure to edit your src/main/configurations/engine.conf and make changes to reflect your current setup. Please see the FTL sample application for an example configuration.

Adapter Properties

Property Description
Connect on Startup If enabled, the adapter connects to the realm server when it starts.
Real Server URLs A pipe-delimited ("|") list of realm server URLs to which to connect (e.g. http://localhost:8080|http://localhost:8181). Should the first server in the list become unavailable, the adapter will automatically try to connect to the next one in the list, and so on.
User name The realm server user name.
Password The realm server password.
Application Name The FTL application, which includes a set of endpoints and formats as configured in the realm server.
Application Instance The FTL application instance.
Endpoint Name The FTL endpoint, which abstracts the transport details.
Buffer Size To enable batching of tuples sent from the adapter, enter a non-zero size of a buffer to maintain in number of tuples. The default is zero, which disables buffering and sends one tuple at a time.
Flush Interval (mS) When using a non-zero buffer size, enter an integer number of milliseconds to specify how often to flush the buffer and send its accumulated tuples.
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.
FTL Library Log Level The log level used by the FTL library. Multiple FTL input and output adapter instances share the most verbose level configured in any adapter.
Message Formats Tab Use this tab to specify the names of the message formats used by the operator. Top-level Message Format describes the name of the FTL message, and the Nested Message Formats list specifies the format names of any nested messages (that is, fields of type Message).

Using the Adapter in a StreamBase Application

This section discusses how to use the TIBCO FTL Publishing Output Adapter in a StreamBase application. As shown in the diagram below depicting the adapter's sample applications, the publishing adapter has two input ports and one output port to communicate with the surrounding application.

The TIBCO FTL Publishing Output Adapter's ports are used as follows:

  • PublishControl: This input port receives tuples used to connect to, or disconnect from, the realm server. The Control port has the following schema:

    • Command, string: Contains one of the following commands:

      • Connect

      • Disconnect

      • JoinGroup (Note that at most one FTL operator per StreamBase application will be able to join a given group on a given realm)

      • LeaveGroup

      • GetJoinedGroupNames

    • GroupID, string: Identifier of the group to join or leave (used by the JoinGroup and LeaveGroup commands).

    • IsObserver, boolean: Whether to join the group as a member (false) or an observer (true) (used by the JoinGroup command).

    • GroupMemberDescriptor, string: JSON string to use as a group member descriptor (used by the JoinGroup command).

    • GroupActivationInterval, double: Number of milliseconds to use as an activation interval (used by the JoinGroup command).

  • PublishIn: Tuples enqueued on this input port cause the adapter to publish FTL messages, one per tuple. The port's schema is derived from the output port of the upstream operator and can contain a subset of StreamBase data types, including lists and nested tuples to include nested messages in the outgoing FTL message. Tuple fields are mapped to FTL message fields by name. List fields may contain only double, long, string, timestamp, and double elements. Fields containing null in the tuple are discarded; no corresponding field is placed in the FTL message.

    In processing outcoming FTL messages, the adapter converts to StreamBase data types to FTL data types. As shown in the table below, Each StreamBase type has a single corresponding FTL type. When an attempt to perform an invalid conversion occurs, a one-time warning for the field is displayed and the corresponding FTL message field is not included in the message.

    StreamBase Type FTL Type
    blob OPAQUE
    double DOUBLE
    list<double> DOUBLE_ARRAY
    long LONG
    list<long> LONG_ARRAY
    string STRING
    list<string> STRING_ARRAY
    timestamp DATETIME
    list<timestamp> DATETIME_ARRAY
    tuple MESSAGE
    list<tuple> MESSAGE_ARRAY
  • PublishStatus: This output port emits status, information, and error tuples. The Status port has the following schema:

    • Status, string: Describes the type of event that occurred. Possible values include: Connected, Disconnected, Success, Error.

    • Time, timestamp: The time at which this status occurred.

    • Info, list(tuple): A list of name-value pair tuples containing any additional information for the event.

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 TIBCO FTL Publishing Output Adapter from the Operators and Adapter drawer in the Palette view to the canvas.

  3. Connect an input streams to the adapter's two input port and an output stream to its output port.

  4. Configure the schema of PublishControl input stream with a Command field.

  5. Configure the schema of PublishIn input stream with the fields to be including in published FTL messages.

  6. Select the adapter icon, and in the Properties view, select Adapter Settings and fill in any desired properties.

Typechecking and Error Handling

The TIBCO FTL Publishing Output adapter uses typecheck messages to help you configure the adapter in your StreamBase application. In particular, the adapter generates typecheck messages when a required property has not been specified, the control input schema is missing a required field, or an input or output schema contains unsupported StreamBase data types.

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

  • The adapter connects, or fails to connect, to the realm server during start-up.

  • An FTL message is acknowledged.

  • The adapter is administratively disabled by the realm server.

  • The adapter receives an advisory message.

  • The adapter fails to dispatch an event on its event queue.

  • The adapter fails to process an outgoing FTL message.

  • The adapter is suspended or resumed.

Suspend and Resume Behavior

When suspended, the TIBCO FTL Publishing Output Adapter disconnects from the realm server and stops processing outgoing FTL messages.

When resumed, the adapter re-connects to the realm server, if it had been connected before being suspended, and resumes processing outgoing FTL messages.