Error Streams Sample

This sample consists of a Studio project that contains three application files (dividemodule.sbapp, dividetoplevel.sbapp and outoforder.sbapp), a customized StreamBase Server configuration file (sbd.sbconf), and a small amount of Java code used by the applications as a custom function. This sample is designed to be walked through using a Cheat Sheet in StreamBase Studio that guides you step by step.

The goal of this sample is to demonstrate various use cases for error streams in StreamBase applications.

Running the Error Streams Sample in StreamBase Studio

This sample uses a StreamBase Studio cheat sheet to provide an interactive walk-through of the Error Ports and Error Streams features.

  1. In StreamBase Studio, select HelpCheat Sheets.

  2. In the Cheat Sheet Selection dialog, open the StreamBase Studio folder, select Sample - Error Streams, and click OK.

  3. Follow the instructions on the cheat sheet Introduction page.

Running the Error Streams Unit Test

This sample includes a StreamBase JUnit test, DivideTest.java. To run it, locate DivideTest.java in the java-src tree in Package Explorer. Right-click DivideTest.java, and select "Run As > StreamBase Unit Test"from the context menu.

The test will cause a division by zero, which prints a red warning message in the Console window. Since the error is caught by the error stream, the application continues to run and the test will pass. Click the JUnit view's tab to verify that both testcases have passed.

Importing This Sample into StreamBase Studio

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

  • From the top menu, select FileLoad StreamBase Sample.

  • Select this sample from the Applications list.

  • Click OK.

StreamBase Studio creates a project for the sample.

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_errorstreams

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/errorstreams

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.