TIBCO FTL Adapter Sample

This sample demonstrates the use of the operators included in the Spotfire Streaming Adapter for TIBCO FTL®.

Note

Before running this sample, be sure to configure the TIBCO FTL tibftl.jar file and make the FTL middleware libraries available to the system, as described in TIBCO Middleware Dependencies in the TIBCO FTL Subscribing Operator or TIBCO FTL Publishing OperatorOperator pages of the Adapters Guide.

Importing This Sample into StreamBase Studio

In StreamBase Studio, import this sample with the following steps:

  • From the top-level menu, click File>Import Samples and Community Content.

  • Enter ftl to narrow the list of options.

  • Select TIBCO FTL input/output adapters from the Other TIBCO Product Connectivity category.

  • Click Import Now.

StreamBase Studio creates a project for this sample.

Running The Sample in StreamBase Studio

You must edit the project's src/main/configurations/engine.conf file to edit the externalNativeLibraryPath and externalClassPath entries to reflect your FTL installation's path.

You must also verify that the system PATH variable includes the FTL bin directory, and it must be the first element in the PATH when this node is installed. This is to prevent possible errors such as the following:

Error is java.lang.UnsatisfiedLinkError: C:\TIBCO\ftl\6.1\bin\tibftljni.dll: 
Can't find dependent libraries
  1. Start the TIBCO FTL realm server. The sample assumes it is running on localhost, port 8080.

  2. In the Project Explorer view, open the sample you just loaded.

    If you see red marks on a project folder, wait a moment for the project to load its features.

    If the red marks do not resolve themselves after a minute, select the project, right-click, and select Maven>Update Project from the context menu.

  3. Open the src/main/eventflow/com.example.sample_ftl folder, and the ftl.sbapp therein to display its contents in the EventFlow editor.

  4. Select the FTLControl adapter icon to open the Properties view for this operator.

  5. Adjust the Realm Server URL, Application Name, and any other properties to match the realm server configuration.

  6. Repeat the previous step for the FTLSub, FTLPub, FTLMapGet, FTLMapSet, FTLMapIterate and FTLMapRemove operators to set their Endpoint property along with any other property you wish to adjust.

  7. Select the ftl.sbapp file in the Project Explorer pane and click the Run button. This opens the SB Test/Debug perspective and starts the module.

  8. In the Test/Debug Perspective, open the Output Streams view. If the adapter is able to connect to the realm server, a Connected status tuple is emitted on the ControlStatus stream. Immediately thereafter, the SubStatus and PubStatus streams will show a Succeeded status tuple, indicating that they are both ready to do business.

  9. In the Manual Input view, select the PublishMessages stream, enter some data and click Send Data. Additional tuples appear in the Output Streams view from the IncomingFTLMessages and AckStatus streams indicating the following:

    • The message published by the FTL Publisher was received by the FTL Subscriber.

    • The received message was acknowledged.

  10. When done, press F9 or click the Terminate EventFlow Fragment button.

To test the Map operators:

  1. Start the TIBCO FTL realm server. The sample assumes it is running on localhost, port 8080.

  2. In the Project Explorer view, open the sample you just loaded.

    If you see red marks on a project folder, wait a moment for the project to load its features.

    If the red marks do not resolve themselves after a minute, select the project, right-click, and select Maven>Update Project from the context menu.

  3. Open the src/main/eventflow/com.example.sample_ftl folder, and the ftl.sbapp therein to display its contents in the EventFlow editor.

  4. Select the FTLControl adapter icon to open the Properties view for this operator.

  5. Adjust the Realm Server URL, Application Name, and any other properties to match the realm server configuration.

  6. Repeat the previous step for the FTLSub, FTLPub, FTLMapGet, FTLMapSet, FTLMapIterate and FTLMapRemove operators to set their Endpoint property along with any other property you wish to adjust.

  7. Select the ftl.sbapp file in the Project Explorer pane and click the Run button. This opens the SB Test/Debug perspective and starts the module.

  8. In the Test/Debug Perspective, open the Output Streams view. If the adapter is able to connect to the realm server, a Connected status tuple is emitted on the ControlStatus stream. Because this sample also includes a Publisher and a Subscriber, immediately after connection the SubStatus and PubStatus streams will show a Succeeded status tuple, indicating that they are both ready to do business. However, the presence of those two operators are not necessary to the operation of the Map operators.

  9. In the Manual Input view, select the MapSetCommand stream, enter MyMap and Key1 as values for the FTLMapName and FTLKeyName fields respectively as well as a value for the myLong payload field and click Send Data. An additional tuple appears in the Output Streams view from the MapSetStatus stream indicating the message was successfully set in the map.

  10. In the Manual Input view, select the MapGetCommand stream and set the following values:

    • FTLMapName: MyMap

    • FTLKeyName: Key1

    Click Send Data. A tuple appears in the Output Streams view from the MapGetResults stream describing the message that was successfully retrieved from the map.

  11. In the Manual Input view, select the MapIterateCommand stream and set the following values:

    • FTLMapName: MyMap

    Click Send Data. Two tuples appear in the Output Streams view from the MapIterateResults stream: one describing the message that was previously added to the map, and one with all fields including FTLMapName and FTLKeyName set to null to indicate the end of the list.

  12. In the Manual Input view, select the MapRemoveCommand stream and set the following values:

    • FTLMapName: MyMap

    • FTLKeyName: Key1

    Click Send Data. A tuple appears in the Output Streams view from the MapRemoveStatus stream to indicate that the message was successfully removed from the map.

  13. When done, press F9 or click the Terminate EventFlow Fragment button.

Sample Location

When you load the sample into StreamBase® Studio, Studio copies the sample project's files to your Studio workspace, which is normally part of your home directory, with full access rights.

Important

Load this sample in StreamBase® Studio, and thereafter use the Studio workspace copy of the sample to run and test it, even when running from the command prompt.

Using the workspace copy of the sample avoids permission problems. The default workspace location for this sample is:

studio-workspace/sample_adapter_embedded_tibco-ftl

See Default Installation Directories for the default location of studio-workspace on your system.