TIBCO Rendezvous Channel Example

This project shows an example of an ActiveSpaces Transactions (AST) channel implementation for sending and receiving messages to/from TIBCO Rendezvous Message bus. The primary goal of this project is to show how TIBCO Rendezvous can be integrated with the AST Channel framework.

View of the example

Please see the enclosed source, javadoc, and example class descriptions.

Usage

Software Dependencies

This example uses native TIBCO Rendezvous libraries, and requires TIBCO Rendezvous 8.4.0 or later to be installed, both a local installation for compiling and testing, and an installation on the AST server.

The TIBCO Rendezvous native libraries can be configured on the AST server using either LD_LIBRARY_PATH or the AST native library feature (See the Developer's Guide for details).

If LD_LIBRARY_PATH is used, it must be updated before starting the AST nodes :-

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TIBRV_HOME/lib/64:$TIBRV_HOME/lib

where $TIBRV_HOME is the location of the TIBCO Rendezvous installation, (e.g., $TIBCO_HOME/tibrv/8.4.0)

In addition, an RVD daemon process must be running and listening on the port which the channel connects to. Default port is 7500, but can be changed on the command line when launching the application and client.

NOTE: This example cannot be deployed in the AST Development Appliance and requires AST nodes installed on the same machine as TIBCO Rendezvous is installed.

The maven pom.xml file for the rvchannel module uses a property, tibrv_home which must point to the local TIBCO Rendezvous installation :-

        <properties>
                <tibrv_home>/opt/tibco/tibrv/8.4.0</tibrv_home>
        </properties>

Alternatively, specify a value for this property on command line when building or deploying the example :-

   mvn clean install -Dtibrv_home=/opt/tibco/tibrv/8.4.0

Command line arguments

The TIBCO channel example makes use of java properties for specifying RVD connection parameter values, if anything else then the default RVD values are used. See Start the sample application and Start the sample client sections for details.

Example application

The example application creates one RVService with one associated RVEndpoint instance. The service initializes the underlying TIBCO Rendezvous environment. The endpoint has a connection to a TIBCO Rendezvous daemon process (RVD) which is represented by an RVD instance. The RVD class encapsulates the interaction with the TIBCO Rendezvous environment.

The application adds one Session for each subject it wants the endpoint to handle, in this example, there are three Sessions; one for inbound traffic and two for outbound traffic. The inbound session listens for messages from the TIBCO message bus matching the desired subject and dispatches them into the RVEndpoint which finally forwards them to the application. The application uses one of the outbound Sessions for sending a response and one Session for publishing an event message.

Example client

The rvchannel package also provides a simple non-AST based TIBCO Rendezvous client. It connects to the RVD and sends one request to the Application and waits for two messages; one response and one published event sent back by the application.

Starting the example

As previously mentioned, this example requires AST nodes to be deployed on a machine on which a TIBCO Rendezvous 8.4.0 or later has been installed.

Start TIBCO Rendezvous daemon process (RVD)

A TIBCO RVD process must be running on the machine where AST nodes are deployed, and listening on the port specified by both client and application. The default port is 7500, but can be changed by using the '-listen' flag.

To start the RVD on the default port (7500):-

>cd $TIBCO_HOME/tibrv/8.4.0/bin
> rvd64 & 

or on a specific port, e.g. 15500 :-

>cd $TIBCO_HOME/tibrv/8.4.0/bin
> rvd64 -listen 15550 & 

Start the sample application

The application can be launched with maven which uses the fluency-maven-plugin :-

Use this command to build the example:

mvn compile

Use this command to start the Exchange Application on node A on the ActiveSpaces Transactions Development Appliance:

NOTE: kabira-server.local only works on OS X. Other platforms may use a different name, or have to specify an IP address.

mvn -Dcom.kabira.fluency.administrationPort=2000 \
      -Dcom.kabira.fluency.hostName=kabira-server.local \
      fluency:exec

The above will use the default TIBCO Rendezvous connection parameters, (service=null, network=null, daemon=null) when connecting to the RVD. You can specify different values for any of these three parameters in two ways :-

By editing the following properties in the pom.xml :-

  • rvService
  • rvNetwork
  • rvDaemon

Or on the command line :-

mvn -Dcom.kabira.fluency.administrationPort=2000 \
      -Dcom.kabira.fluency.hostName=10.170... \
      -DrvService=... -DrvNetwork=... -DrvDaemon=... \
      fluency:exec

Please consult your TIBCO Rendezvous documentation for more information about these connection parameters.

When the application is ready, you will see :-

[A] RV Service rendezvous started
[A] ==============================================
[A] TIBCO RV channel service started.
[A] To stop this application, stop the "rendezvous" service.
[A] ==============================================

At this point, you can launch the client program and inject a request.

Start the sample client

The sample client is a non-AST based java program, hence can be launched on any machine which has a Java runtime (v1.5 or greater) and TIBCO Rendezvous (v8.4.0 or greater) installed, with an RV Daemon running. Like the application, the sample client connects to the RVD using the default values for Service, Network and Daemon (all 'null'). These can be overridden by providing the following java properties :-

  • client.rvService
  • client.rvNetwork
  • client.rvDaemon

Like starting the AST runtime, the LD_LIBRARY_PATH and PATH variables must be set in the shell where the client is to be launched :-

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TIBRV_HOME/lib/64:$TIBRV_HOME/lib
export PATH==$PATH:$TIBRV_HOME/bin

where $TIBRV_HOME is the location of the TIBCO Rendezvous installation, (e.g., $TIBCO_HOME/tibrv/8.4.0)

We can can now launch the client :-

java -cp /path/to/rvchannel-<version>.jar:$TIBRV_HOME/lib/tibrvnative.jar \
        com.tibco.rvchannel.client.Main

And if using different RVD connection values :-

java -cp /path/to/rvchannel-<version>.jar:$TIBRV_HOME/lib/tibrvnative.jar \
        -Dclient.rvService=... -Dclient.rvNetwork=... -Dclient.rvDaemon=... \
        com.tibco.rvchannel.client.Main

The client program will connect to the RVD daemon process, send a request and then wait for the response and an additional event message returned by the application. Both application and client will print out the messages to the console.

Here is the client output:-

Sending: {messageType=1 correlationId="65264122203525" requestData="A request from the client" timeStamp=65264122253525}
Received: {messageType=2 correlationId="65264122203525" responseData="Response data returned from AST" responseCode=0 timeStamp=65264124449525}
Received: {messageType=3 eventData="Request received from network" timeStamp=65264124449525}

And the corresponding output from the application after client has sent the request:-

[A] decode: RequestMessage [messageType=1, correlationId=65264122203525, requestData=A request from the client, timeStamp=65264122253525, replySubject=_LOCAL.destination.client.inbound]
[A] encode: ResponseMessage [messageType=2, correlationId=65264122203525, responseData=Response data returned from AST, responseCode=0, timeStamp=65264124449525, sendSubject=_LOCAL.destination.client.inbound]
[A] encode: EventMessage [messageType=3, eventData=Request received from network, timeStamp=65264124449525]

Administration

Integrating the TIBCO Rendezvous channel with the ActiveSpaces Transactions Channel framework allows the channel to be managed using ActiveSpaces Transactions administration tools.

In the following ActiveSpaces Transactions Administrator view, the "rendezvous" Service from the example application is selected. One endpoint, "BusinessEndpoint", is attached to the "rendezvous" Service and represents the connection with the TIBCO Rendezvous Daemon process.

View of the RV service ("rendezvous") in ActiveSpaces Transactions Administrator.

To shut down the application, stop the "rendezvous" service via the ActiveSpaces Transactions Administrator, using the "stop" button in the upper right corner of the Service rendezvous window.

The Endpoint has three Session instances for managing inbound and outbound session-level statistics:-

View of the "BusinessEndpoint" Endpoint in ActiveSpaces Transactions Administrator.

Selecting a named Session instance will show the details for that instance:-

View of a session in ActiveSpaces Transactions Administrator console.