TIBCO ActiveMatrix BPM Operator Sample

This topic describes how to run the TIBCO ActiveMatrix BPM® operator sample application, which illustrates how to use the operator with an ActiveMatrix BPM server. For more information on this operator, see Using the TIBCO ActiveMatrix BPM Operator.

Sample Overview

This demonstrates a few of the available REST APIs available via the ActiveMatrix BPM server. Every ActiveMatrix BPM REST service can be called by this single operator depending on its setup. In this demo we will cover three of them:

  • BusinessServicesList

  • BusinessServicesStart

  • BusinessServicesCancel

This Sample's Files

This sample has the following files:

  • The sample EventFlow application, demo.sbapp.

  • A corresponding sbd.sbconf, which is used by the StreamBase Server to correctly configure the Java environment and to set up the parameters required for the demo.

Running This Sample in StreamBase Studio

The steps to run this sample in Studio are as follows:

  1. There are a few parameters that must be setup in the sbd.sbconf file before this sample is run. These options will tell the sample which ActiveMatrix BPM business service we will be using. To change the operations please do the following:

    • Open the sbd.sbconf for editing.

    • Edit the operator-parameter value fields with the correct information for you server and your business service.

  2. In the Package Explorer, double-click to open the demo.sbapp application.

  3. Make sure the application is the currently active tab in the EventFlow editor, then click the Run button. This opens the SB Test/Debug perspective and starts the application.

  4. In the Manual Input view, select the InBusinessServicesList input stream.

  5. Click Send Data, this will trigger the BusinessServiesList REST API to be called and an output tuple will be created with the results.

  6. Still in the Manual Input view, select the InBusinessServicesStart stream and click Send Data (leaving all fields null). This will cause the default values you had previously entered into the sbd.sbconf to be sent as part of a Business Services Start REST API call.

  7. In the Application Output view, select the last item displayed for the Output Stream OutBusinessServicesStart and copy the value of the output fields via path 'serviceResults\context\processReference\id'.

  8. In the Manual Input view, select the InBusinessServicesCancel stream.

    Enter the following values:

    • processId: Use the process Id copied from the step above

    Click Send Data which will trigger a business services cancel operation with the given process Id to be sent to the server.

  9. When done, press F9 or click the Stop Running Application button.

Running This Sample in Terminal Windows

This section describes how to run this sample in Windows command prompt or Unix terminal windows. Be sure to use the StreamBase Command Prompt from the Start menu as described in the Test/Debug Guide, not the default command prompt.

  1. There are a few parameters that must be setup in the sbd.sbconf file before this sample is run. These options will tell the sample which ActiveMatrix BPM business service we will be using. To change the operations please do the following:

    • Open the sbd.sbconf for editing.

    • Edit the operator-parameter value fields with the correct information for you server and your business service.

  2. Open three terminal windows on UNIX, or three StreamBase Command Prompts on Windows.

  3. In window 1, navigate to the directory location where your project resides, then start StreamBase Server with the application file as its argument. For example:

    cd /d "C:\Users\username\Documents\StreamBase Studio X.Y Workspace\sample_tibco_activematrix_bpm"
    sbd -f sbd.sbconf demo.sbapp
  4. In window 2, type:

    sbc dequeue

    This window will display tuples dequeued from the application's output ports.

  5. In window 3, type:

    sbc enq InBusinessServicesList

    This window is now ready to accept tuples to the InBusinessServicesList stream, typed with CSV syntax.

  6. In window 3, type a space character then return (which will trigger a call to the Business Services List REST API):

  7. Observe in window 2 one tuple is emitted on the OutBusinessServicesList stream

  8. In window 3, type Ctrl+C to exit sbc, then type:

    sbc enq InBusinessServicesStart

    This window is now ready to accept tuples to the InBusinessServicesStart stream, typed with CSV syntax.

  9. In window 3, type the following, (which will trigger a call to the Business Services Start REST API with the defaults provided by your sbd.sbconf file).

    null,null,null,null

  10. Observe in window 2 one tuple is emitted on the OutBusinessServicesStart stream.

    Copy the value process ID produced by the output, which will be the first item that starts with pvm:

    Example (broken into multiple lines for clarity):

    OutBusinessServicesStart,"IN_PROGRESS,""""""/WelcomeUsersImplementSolution/
    Process Packages/ProcessPackage.xpdl,RequestCall,1.0.0.20150504194434764"""",
    """"pvm:0a102e,RequestCall"""""",""""""pvm:001g2e.3,CollectData,
    _RMlPeSIbEeCnP8eZZTCDGg,/WelcomeUsersImplementSolution/Process Packages/
    ProcessPackage.xpdl,1.0.0.20150504194434764,RequestCall"""",""""JSON,
    ...
  11. In window 3, type Ctrl+C to exit sbc, then type:

    sbc enq InBusinessServicesCancel

    This window is now ready to accept tuples to the InBusinessServicesCancel stream, typed with CSV syntax.

  12. In window 3, type or paste the value that starts with pvm that you copied in step 10 (which triggers a call to the Business Services Cancel REST API).

  13. Observe in window 2 one tuple is emitted on the OutBusinessServicesCancel stream.

  14. In window 2, type Ctrl+C to terminate the dequeuing process. Then type the following command to shut down the server:

    sbadmin shutdown

Importing This Sample into StreamBase Studio

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

  • From the top-level menu, select FileLoad StreamBase Sample.

  • Type active to narrow the list of options.

  • Select TIBCO ActiveMatrix BPM Operator from the Extending StreamBase category.

  • Click OK.

StreamBase Studio creates a single project for the ActiveMatrix BPM Operator sample in your current Studio workspace.

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 the permission problems that can occur when trying to work with the initially installed location of the sample. The default workspace location for this sample is:

studio-workspace/sample_tibco_activematrix_bpm

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

In the default TIBCO StreamBase installation, this sample's files are initially installed in:

streambase-install-dir/sample/tibco_activematrix_bpm

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