- Index

< Previous |  | Next >

# 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 has been tested with FTL version 3.1, though it will likely work with newer FTL API versions as well. 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.
Realm Server URL | The URL of the realm server.
Secondary Realm Server URL | The URL of the secondary realm server for fault tolerance.
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.

## 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

- 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:

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

    - Administration: the adapter has received notification that it has been administratively disabled

    - Advisory: an advisory message has been received

    - Connect: the adapter has connected or failed to connect to, or disconnected from, the FTL realm server

    - Dispatch: an error occurred dispatching an event on the adapter's event queue

    - Suspend/Resume: the adapter is being suspended or has been resumed

    - User Input: an input tuples was rejected

  - action, string: the action associated with the event, such as Connected, Disconnected, Suspended, or Resumed.

  - object, string: the name of the object associated with the event, such as the URL of the realm server or the name of the adapter that was suspended or resumed.

  - message, string: a human-readable message string

  - inputTuple, tuple: the tuple enqueued to the control port that lead to the event, or null if the event was not related to processing an input tuple.

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.

## Related Topics

- TIBCO FTL Publishing Output Adapter

- TIBCO FTL Map Adapters