TIBCO Rendezvous External Adapter

This topic describes the StreamBase External Adapter for TIBCO Rendezvous™, which converts Rendezvous messages into StreamBase tuples, and vice versa.

StreamBase also provides a pair of input and output embedded adapters for TIBCO Rendezvous. The embedded adapters are described in TIBCO Rendezvous Subscribing Input Adapter and TIBCO Rendezvous Publishing Output Adapter.

Deprecation Notice

As of StreamBase release 7.2.0, the TIBCO Rendezvous External adapter is deprecated and will be removed in a future release. New applications should migrate to the embedded support for TIBCO Rendezvous connections described above.

Introduction

The StreamBase External Adapter for TIBCO Rendezvous performs the conversion between Rendezvous messages and StreamBase tuples, supporting data flow in both directions. When converting data from a tuple to a Rendezvous message, the fields in a StreamBase schema become the fields in a Rendezvous message. When converting data from a Rendezvous message, only the fields in the message that have matching name and data type will be copied into the fields in a tuple.

Note

The following Rendezvous features are not supported by the external adapter: Certified Messaging, Distributed Queue, Priority Queue, SSL, and fault tolerance.

Installation

Installation on Windows

Prerequisite

The installation for the StreamBase adapter assumes that TIBCO Rendezvous is installed on your system, and its directory is on your PATH.

Installation on Linux

Prerequisite

The installation for the StreamBase adapter assumes that TIBCO Rendezvous is installed at /usr/tibco/tibrv. If Rendezvous is installed in a different location, you must set the TIBRV_DIR environment variable to the actual path of Rendezvous prior to installing the StreamBase adapter package. For example:

export TIBRV_DIR=/local/tibco/tibrv_7.2

The StreamBase Adapter for TIBCO Rendezvous on Linux is packaged in two ways:

  • Red Hat Package Manager (RPM) file.

    To install the RPM package , execute the following command as root:

    rpm -Uvh streambase-tibrv-XXXXXXXX.rpm

    (where XXXXXXXX contains the release-specific information.)

  • A tarball file.

    To install the adapter from the tarball, execute the following command as root:

    tar -xzf streambase-tibrv-adapter-XXXXXXXX.tar.gz

    (where XXXXXXXX contains the release-specific information.)

    After installing the Adapter from the tarball, you must install an additional StreamBase library, using the following command:

    streambase-install-dir/lib/build-libsbrv

On Red Hat and SUSE Linux with SELinux enabled, the TIBCO Rendezvous adapter may terminate with an error on startup with wording such as cannot restore segment prot after reloc. If you encounter this error, you must either disable SELinux or reconfigure it to allow runtime relocations in the adapter. See your operating system documentation for instructions on configuring SELinux.

Supported Rendezvous-to-StreamBase Data Type Conversions

The following table describes the supported conversions from Rendezvous to StreamBase.

Rendezvous StreamBase
tibrv_bool bool
tibrv_i8 int
tibrv_i16 int
tibrv_u8 int
tibrv_u16 int
tibrv_i32 int
tibrv_f32 double
tibrv_f64 double
tibrvMsgDateTime timestamp
char* string (limited to the maximum string length allowed)
void* string (limited to the maximum string length allowed)

The following Rendezvous datatypes are unsupported (and ignored) because there are no matching StreamBase data types.

  • tibrv_i64

  • tibrv_u32

  • tibrv_u64

  • tibrv_ipaddr32

  • tibrv_ipport16

  • array

  • User-defined datatypes

Nested Messages

A Rendezvous message can contain another Rendezvous message; Rendezvous messages can be nested. The StreamBase Adapter for TIBCO Rendezvous looks for nested Rendezvous messages, extracts the values of the contained fields, and writes them onto a tuple. The TIBCO Rendezvous adapter takes a Rendezvous message with nested messages and flattens it out onto a tuple.

The TIBCO Rendezvous adapter maps a field in a Rendezvous message to a field on a StreamBase schema by matching their names. Nested messages work similarly. Given an incoming Rendezvous message that holds a nested message, the TIBCO Rendezvous adapter looks at each field in the nested message and tries to map it to a field on the tuple by name.

One consideration complicates this process: given nested messages, more than one message might have a field with the same name. For example, consider a tibrv message with three fields: a string field named stringField1, a string field named stringField2, and a message field named messageField1. The nested message messageField1 may also have a string field named stringField1, which results in a naming conflict.

The StreamBase TIBCO Rendezvous adapter deals with this by qualifying the name of the fields in a nested message with the name of the message that contains them. An underscore is placed between the name of the nested message and the name of its field.

In the above example, the top level message had three fields. The StreamBase TIBCO Rendezvous adapter will look for fields on the schema named stringField1 and stringField2. Since messageField1 has a type of TibrvMsg, the TIBCO Rendezvous adapter tries to map its contained field using the name messageField1_stringField1. That is, the name of a nested field consists of the name of its containing message, followed by an underscore, followed by its name.

Supported StreamBase-to-Rendezvous Data Type Conversions

The following table describes the supported conversions from StreamBase to Rendezvous.

StreamBase Rendezvous
bool tibrv_bool
int tibrv_i32
double tibrv_f64
timestamp tibrvMsgDateTime
string char*

Rendezvous Subject-to-StreamBase Stream Mapping

The StreamBase Adapter supports the following Rendezvous subject to StreamBase stream mappings:

  • Single Rendezvous subject to single StreamBase stream

  • Multiple Rendezvous subjects to single StreamBase stream

  • Rendezvous wildcarded subject to single StreamBase stream

The following XML elements show how to configure these mappings in the adapter configuration file:

<!-- Single Rendezvous subject to single StreamBase stream mapping -->
<rv-to-sb src-subject="SIAC.HPQ.N" dest-stream="hpq_stock"/>

<!-- Multiple Rendezvous subjects to single StreamBase stream mapping -->
<rv-to-sb src-subject="SIAC.IBM.N" dest-stream="siac_stocks"/>
<rv-to-sb src-subject="SIAC.T.N" dest-stream="siac_stocks"/>
<rv-to-sb src-subject="SIAC.GE.N" dest-stream="siac_stocks"/>

<!-- Rendezvous wildcarded subject to single StreamBase stream mapping -->
<rv-to-sb src-subject="IDN.*.N" dest-stream="idn_stocks"/>

<!-- Single StreamBase stream to single Rendezvous message mapping -->
<sb-to-rv src-stream="AlertsIDN" dest-subject="alert_watch"/>

<!-- Using the subject found in tuple for publishing Rendezvous messages -->
<sb-to-rv src-stream="LowVolumeIDN" dest-subject=""/>

When a wildcarded Rendezvous subject is mapped to a stream, the subject of each Rendezvous message is carried in a tuple field. By default this tuple field is named RV_subject. Its name may be changed by setting the subject-field-name attribute of the rv-endpoint element in the adapter configuration file. For example:

<rv-endpoint daemon="127.0.0.1:7500" network="127.0.0.1" service="7500" batch="false" 
    convert-numeric-id-to-name="true" subject-field-name="tibco_subject" 
    field-name-and-id="false"/>

The subject carried in a tuple will be used when publishing messages to the Rendezvous bus from a StreamBase output stream if the destination subject (dest-subject) attribute of the sb-to-rv element is missing or set to empty string.

Note

When configuring the adapter, using localhost in the daemon parameter may fail. This is because localhost is sometimes interpreted to correspond to the loopback network interface, rather than to one of the external network interfaces. We recommend that you use a hostname or IP address (in place of localhost) that corresponds to the network interface you wish to use. Generally the hostname of the machine or its IP address (on a machine with only one network interface) is sufficient.

Rendezvous Field Identifier Support

By default, data in Rendezvous message fields are copied into the StreamBase tuple fields that have matching field names and data types. Some message fields may only have field identifiers, but no field names. Set the convert-numeric-id-to-name attribute of the rv-endpoint element to true to convert message fields that only have field identifiers. For example:

<rv-endpoint daemon="127.0.0.1:7500" network="127.0.0.1" service="7500" batch="false" 
    convert-numeric-id-to-name="true" subject-field-name="tibco_subject" 
    field-name-and-id="true"/>

Null Support

When converting a Rendezvous message to a StreamBase tuple, a tuple field that does not have a matching message field will be set to null. When converting a StreamBase tuple into a Rendezvous message, tuple fields whose values are null will be ignored.

Sample Applications

When you run the sb-tibrv command, the adapter reads a required configuration file and connects to StreamBase Server (sbd) and the Rendezvous Daemon (rvd) accordingly.

The external adapter kits installs three sample applications to help you understand the Rendezvous-to-StreamBase (and vice versa) interaction. These samples are installed in streambase-install-dir\sample\adapter\external\tibrv.

The sample appears in StreamBase Studio's Load StreamBase Sample dialog only after you install the TIBCO Rendezvous External Adapter kit.

The first sample includes the following files:

File Description
datafile.csv Rendezvous message data file.
PennyStockAlert.sbapp StreamBase EventFlow sample application.
rv_pennystockalert.sbconf Adapter configuration file.
run_pennystockalert.sh Sample run script for Linux.
run_pennystockalert.bat Sample run script for Windows.
sbrvdriver Test driver for Linux.
sbrvdriver.exe Test driver for Windows

This sample assumes that you downloaded and installed Rendezvous on a supported machine where StreamBase is also installed. For information about downloading an evaluation copy of Rendezvous, see the TIBCO web site.

Running the PennyStockAlert Sample

On Windows, you must use StreamBase Command Prompt windows, not standard Windows command prompts.

To run this sample application, follow these steps. Commands are shown in the correct form for Linux; Use the same commands without the trailing ampersand on Windows.

  1. Copy all the sample's files to a subdirectory in your home directory, or navigate to the Studio workspace location for this sample.

  2. In window 1, start StreamBase Server and load the sample application:

    sbd PennyStockAlert.sbapp &
    
  3. In window 2, start the TIBCO Rendezvous Daemon rvd:

    rvd &
    
  4. In window 3, start the StreamBase adapter program with the following command:

    sb-tibrv -f rv_pennystockalert.sbconf  &
    
  5. In window 4, run Rendezvous's sample program to listen on the subject alert_watch:

    tibrvlisten alert_watch &
    
  6. In window 5, run this sample's shell script or batch file:

    ./run_pennystockalert.sh
    
    run_pennystockalert.bat
    

    tibrvlisten displays messages when it detects a price less than 1.0.

The PennyStockAlert Sample's Components

The run_pennystockalert.sh shell script runs sb-tibrv-driver with the following set of Rendezvous message fields (as shown in the table below) and the message subject, tickers.nyse. The run_pennystockalert.sh script feeds the driver with message content from a data file, datafile.csv.

Field Name Data Type
symbol string
price f64
stockid i32
bluechip bool
date datetime

The sb-tibrv-driver program is the StreamBase Adapter for TIBCO Rendezvous, which sends Rendezvous messages to a subject of user's choice. You can enter values of message fields interactively or pipe the values from a data file.

PennyStockAlert.sbapp is the sample StreamBase application that includes a Filter operator. It checks the stock prices in each tuple and sends the tuple to the output stream alters_nyse if the price is less than 1.0.

The configuration file, rv_pennystockalert.sbconf, is configured to have the adapter do the following:

  1. Listen on the Rendezvous message subject tickers.nyse.

  2. Convert messages that have the subject tickers.nyse to StreamBase tuples and sending the tuples to the input stream stocks_nyse.

  3. Receive StreamBase tuples from the StreamBase Server output stream alerts_nyse and converting them into Rendezvous messages.

  4. Send the messages to the subject alter_watch.

You can use this example configuration file, rv_pennystockalert.sbconf, as a basis for creating your own configuration file that you would run with the sb-tibrv -f filename.sbconf command. The example configuration file contains the following:

<?xml version="1.0"?>
<rv-adapter-configuration>
 <rv-endpoint daemon="127.0.0.1:7500" network="localhost" service="rendezvous" batch="false"/>
 <sb-endpoint uri="sb://localhost:10000" max_to_buffer="200" buffer_timer="10" />
 <rv-to-sb src-subject="tickers.nyse" dest-stream="stocks_nyse"/>
 <sb-to-rv src-stream="alerts_nyse" dest-subject="alert_watch"/>
</rv-adapter-configuration>

The dest-subject attribute value corresponds to the output subject. If an output stream is not mapped to a destination subject (either the attribute dest-subject is missing or is set to ""), the adapter publishes a message using the subject found in the tuple field that carries the Rendezvous subject to publish. The name of this field defaults to RV_subject. It can be configured by setting the attribute subject-field-name. If the tuple's subject is null, the tuple is skipped.

Note

When configuring the adapter, using localhost in the daemon parameter may fail. This is because localhost is sometimes interpreted to correspond to the loopback network interface, rather than to one of the external network interfaces. We recommend that you use a hostname or IP address (in place of localhost) that does correspond to the network interface you wish to use. Generally the hostname of the machine or its IP address (on a machine with only one network interface) is sufficient.

Finally, datafile.csv contains values of Rendezvous messages that can be piped to the adapter driver.

Second Sample

The second sample includes the following files:

File Description
datafile_index_idn.csv Sample data.
datafile_index_siac.csv Sample data.
index_idn_siac.sbapp StreamBase EventFlow sample application.
index_idn_siac.sbconf Adapter configuration file.
index_idn_siac.sh Run script for Linux.
index_idn_siac.bat Run script for Windows.
sbrvdriver_index Test driver for Linux.
sbrvdriver_index.exe Test driver for Windows.

This sample differs from the first one in the following areas:

  • It demonstrates how the adapter can be configured to process Rendezvous messages that have field identifiers but empty field names. By setting the attribute convert-numeric-id-to-name to true in the adapter configuration file, the adapter converts the message field that has a numeric identifier xyz to a tuple field named by _xyz.

  • With the attribute convert-numeric-id-to-name set to true, if the attribute field-name-and-id is missing or set to false, the adapter converts the tuple field named by _xyz to a message field with a numeric identifier xyz. The message field name is set to an empty string. If the attribute field-name-and-id is set to true, the message filed name will be set to xyz as well.

  • It demonstrates the use of subject that has wildcard characters such as *.

  • It shows how dynamic subject publishing can be done. If an output stream is not mapped to a destination subject (either the attribute dest-subject is missing or is set to "") the adapter publishes a message using the subject found in the tuple field that carries the Rendezvous subject to publish. The name of this field defaults to RV_subject. It can be configured by setting the attribute subject-field-name. If the tuple's subject is null, the tuple is skipped.

Third Sample

The third sample is the same as the second sample except that StreamBase tuples have fields which are not found in Rendezvous messages. When converting a Rendezvous message to a StreamBase tuple, each StreamBase field that does not have a matching Rendezvous message field will be set to null. When converting a StreamBase tuple to a Rendezvous message, tuple fields whose values are null will be ignored.

The third sample includes the following files:

File Description
datafile_index_idn.csv Sample data.
datafile_index_siac.csv Sample data.
index_idn_siac_missing_fields.sbapp StreamBase EventFlow sample application.
index_idn_siac.sbconf Adapter configuration file.
index_idn_siac.sh Run script for Linux.
index_idn_siac.bat Run script for Windows.
sbrvdriver_index Test driver for Linux.
sbrvdriver_index.exe Test driver for Windows.

Back to Top ^