Taking a Test Drive

To verify that your TIBCO ActiveSpaces Connector for Apache Pulsar installation is ready for configuration and deployment, perform the following general tasks and confirmations. This test drive uses default configurations and usage examples; your requirements may vary depending on your use cases.

This section assumes operation in a Linux or macOS environment, with the FTL Server used as a message broker.

TIBCO ActiveSpaces Connector for Apache Pulsar

See the TIBCO ActiveSpaces Connector for Apache Pulsar Installation manual.

Environment Variables

For simplified operation, set the following environment variables.

  • FTL_HOME –– the base FTL installation directory
  • APD_HOME –– the base Pulsar installation directory, which must have write permissions
  • AS_APD_BRIDGE_HOME –– the TIBCO ActiveSpaces Connector for Apache Pulsar installation directory
  • AS_HOME –– the base AS installation directory
  • PULSAR_LOG_DIR –– temporary directory with write permissions to redirect the log files

Example:

export FTL_HOME=/opt/tibco/ftl/6.5
export AS_HOME=/opt/tibco/as/4.5
export APD_HOME=/opt/tibco/apd/core/2.6
export AS_APD_BRIDGE_HOME=/opt/tibco/apd/as-bridge/1.0
Note: You must set these environment variables for every new command line window you open.

Paths

Add the following directories to your programs search path. These examples use typical paths for default software installations and may need to be modified to reflect the specific installation directories for software on your system.

Example:

export PATH=$FTL_HOME/bin:$PATH
export PATH=$FTL_HOME/samples/bin:$PATH
export PATH=$FTL_HOME/samples/scripts:$PATH
export PATH=$AS_HOME/samples/bin:$PATH
export PATH=$APD_HOME/bin:$PATH

To use SQLLine with the ActiveSpaces JDBC driver, you must set your java.library.path to include both the ActiveSpaces and FTL native libraries, and to include the tibdg.jar file on your CLASSPATH.

You can download SQLLIne from https://repo1.maven.org/maven2/sqlline/sqlline/1.9.0/sqlline-1.9.0-jar-with-dependencies.jar.

Start ActiveSpaces and Apache Pulsar

Start the FTL and Pulsar servers first, and then the bridge connectors. You must have administrative permissions to run these commands.

  1. Source the sample FTL setup script

    cd $FTL_HOME/samples
    . ./setup
  2. Source the samples setup script:

    cd $AS_HOME/samples
    . ./setup
  3. Run the startup script:

    $AS_HOME/samples/scripts/as-start-ftl6 -r http://localhost:8585
    You see:
    Using FTL Server at http://localhost:8585 with grid data at /home/user/activespacesdata
    Using localhost:7171 for tibdgadmind listen address
    Starting FTL server
    Generated FTL configuration file '/home/user/activespacesdata/ftl.yaml' containing:
    
    globals:
        core.servers:
            SRV1: localhost:8585
    
    servers:
        SRV1:
        - realm:
            data: /home/user/activespacesdata/realm_data
            logfile: /home/user/activespacesdata/logs/rs.log
    services:
        realm: {}
    
    Waiting for FTL server start
    Waiting for FTL server start
    Waiting for FTL server start
    Configuring grid
    Starting tibdgadmind
    Performing grid rebuild
    Starting keeper k1
    Waiting for keeper k1 start 1/30
    keeper k1 is running
    Starting proxy p1
    proxy p1 is running
    Starting node n1
    node n1 is running
    Waiting for grid to be online 1/30
    Grid is online
  4. Start Apache Pulsar.

    $APD_HOME/bin/pulsar standalone --zookeeper-dir \
    /tmp/pulsar --bookkeeper-dir /tmp/pulsar

Using the Connector

  1. Create an ActiveSpaces sink, specifying the activespaces sink type, the location of the example sink YAML configuration file, and the Pulsar input topic, as-demo, to read from.

    $APD_HOME/bin/pulsar-admin sinks create --tenant public \
    --namespace default --name activespaces-sink --sink-type activespaces \
    --inputs as-demo --sink-config-file \
    $AS_APD_BRIDGE_HOME/config/activespaces-sink.yaml
    You see:
    "Created successfully"
  2. Send some FTL JSON data to the as-demo topic in Apache Pulsar:
    echo '{"customerID": 1, "firstName": "Ned", "lastName": "Ryerson"}' | \
    $APD_HOME/bin/pulsar-client produce -f /dev/stdin as-demo
    
    echo '{"customerID": 2, "firstName": "Phil", "lastName": "Connors"}' | \
    $APD_HOME/bin/pulsar-client produce -f /dev/stdin as-demo
    
    echo '{"customerID": 3, "firstName": "Rita", "lastName": "Hanson"}' | \
    $APD_HOME/bin/pulsar-client produce -f /dev/stdin as-demo
  3. Verify that the as-demo table has been automatically created in the ActiveSpaces grid and contains three rows for the three messages sent, using the SQLLine tool.

    You can download SQLLIne from here:

    https://repo1.maven.org/maven2/sqlline/sqlline/1.9.0/sqlline-1.9.0-jar-with-dependencies.jar

    Note:

    To use SQLLine with the ActiveSpaces JDBC driver, set the java.library.path to include both the ActiveSpaces and FTL native libraries, and include the tibdg.jar file on the CLASSPATH.

    For this test drive session, press 'Enter' for username and password.

    java -Djava.library.path="/opt/tibco/as/current-version/lib:/opt/tibco/ftl/\
    currentversion/lib" -cp /opt/tibco/as/current-version/lib/tibdg.jar:/rv/home/\
    <username>/sqlline-1.9.0-jar-with-dependencies.jar sqlline.SqlLine -u \
    "jdbc:tibco:tibdg:_default;realmurl=http://localhost:8585"
    Enter username for jdbc:tibco:tibdg:_default;realmurl=http://localhost:8585:
    Enter password for jdbc:tibco:tibdg:_default;realmurl=http://localhost:8585:
    Transaction isolation level TRANSACTION_REPEATABLE_READ is not supported. Default (TRANSACTION_NONE) will be used instead.
    sqlline version 1.9.0
    0: jdbc:tibco:tibdg:_default> select * from "as-demo" ;
    +------------+-----------+----------+
    | customerid | firstname | lastname |
    +------------+-----------+----------+
    | 1          | Ned       | Ryerson  |
    | 2          | Phil      | Connors  |
    | 3          | Rita      | Hanson   |
    +------------+-----------+----------+
    3 rows selected (0.041 seconds)
    0: jdbc:tibco:tibdg:_default> !quit

Stopping the Service

To stop Apache Pulsar in standalone mode, enter CTRL-C from the window in which it is running.:

To stop the ActiveSpaces server:

$AS_HOME/samples/scripts/as-stop-ftl6 -r http://localhost:8585

Deleting the Connectors

To delete the sink connector::

$APD_HOME/bin/pulsar-admin sinks delete --name "activespaces-sink"

You see:

Deleted successfully

This deletes the TIBCO ActiveSpaces Connector for Apache Pulsar from the current Apache Pulsar configuration but does not remove it from the Apache Pulsar installation connectors/ directory. The .nar file for the TIBCO ActiveSpaces Connector for Apache Pulsar is still present, and re-running the previous pulsar-admin command makes the TIBCO ActiveSpaces Connector for Apache Pulsar available for use again.

Log Files

The TIBCO ActiveSpaces Connector for Apache Pulsar creates log files in the following directories :

  • /tmp/functions/public/default/activespaces-sink
    Note: If you do not set this environment, the bridge attempts to create the log files in the same directories in which Apache Pulsar is installed, which by default are not writable and will result in an error message.