Contents
This sample demonstrates the use of the TIBCO StreamBase® Output Adapter for TIBCO Spotfire® Automation Services. The Spotfire Automation Services output adapter sends a Job XML payload via a SOAP 1.1 request to a specified Spotfire automation services URL. The samples require that you have a running Spotfire automation service and is accessible from StreamBase. The samples also require that you have a working Job XML file to be sent to the server. The ExecuteJob sample will execute a job with the given Job XML on the Spotfire automation service and output a single tuple with the resulting status and message from the server. The LaunchAndStatus sample allows you to launch a job and save the inputted information for later requests of job status. The LaunchAndStatusLoop sample will launch a job and with the output tuple JobId will request the job status each second until the job is complete. The output of each sample can be passed on to downstream components for further processing.
-
In the Package Explorer, double-click to open the
ExecuteJob.sbapp
,LaunchAndStatus.sbapp
, orLaunchAndStatusLoop.sbapp
example. Make sure the application is the currently active tab in the EventFlow Editor. -
Select the Parameters tab in the EventFlow Editor and change the SpotfireURL to the base URL of your Spotfire automation services.
-
Select the SpotfireJob component in the EventFlow Editor and copy and paste your Job XML into the Job XML field of the Adapter Properties. The samples come with some example Job XML which should be replaced with your Job XML. The example XML shows how you can use the ReplacementFields of an incoming tuple to dynamically change the XML for each request to the automation service, notice the $[ParameterFieldX] fields. The parameter fields can be any name so long as they match a sub field name of the ReplacementFields incoming tuple.
-
Click the Run button. This opens the SB Test/Debug perspective and starts the application.
-
For the example, in the Manual Input view, click
to send the defaultnull
tuple. You may also fill in values for each sub field of the ReplacementFields field and click to see how fields are replaced in the Job XML. -
In the Application Output view, observe tuples emitted on the
JobStatus
output streams. For theExecuteJob.sbapp
you will notice a single tuple when the job has completed execution. For theLaunchAndStatus.sbapp
you will notice an initial status tuple and then a tuple each second with the job status until the job has completed on the server. -
Press F9 or click the Stop Running Application button.
This section describes how to run this sample in UNIX terminal windows or Windows command prompt windows.
On 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.
-
Open three terminal windows on UNIX, or three StreamBase Command Prompts on Windows. In each window, navigate to your workspace copy of the sample, as described above.
-
In window 1, type:
If you are running the Execute Job example:
sbd ExecuteJob.sbapp
If you are running the Launch Job And Status example:
sbd LaunchAndStatus.sbapp
If you are running the Launch Job And Status Loop example:
sbd LaunchAndStatusLoop.sbapp
-
In window 2, type:
sbc dequeue JobStatus
This window will display tuples dequeued from the adapter's job information output port.
-
In window 3, type:
sbc enqueue JobInput
then type:
null,null,full path to job xml file,URL to your Spotfire server,null
Repeat this step to check the status of the job.
-
If running the Launch Job and Status example then in window 4, type:
sbc enqueue StatusInput
then type:
A space or tab followed by the enter key
-
Observe in window 2 that tuples are emitted from the
JobStatus
stream. The tuples contains fields: Status, Message, JobId, and InputTuple. -
In window 3, type Ctrl+C, then the following command to terminate the server and dequeuer:
sbadmin shutdown
In StreamBase Studio, import this sample with the following steps:
-
From the top menu, select
→ . -
Select
Spotfire Automation Services Output adapter
from the StreamBase Standard Adapters category. -
Click OK.
StreamBase Studio creates a single project containing the sample files.
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_adapter_embedded_spotfire_automation_services
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/adapter/embedded/spotfire-automation-services
See Default Installation
Directories for the location of streambase-install-dir
on your system. This location
may require administrator privileges for write access, depending on your platform.