StreamBase .NET Client Sample

The StreamBase .NET client sample contains three C# and one VB.NET applications that enqueue tuples to, and dequeue tuples from, a StreamBase application. The StreamBase application performs a simple Map operation on the incoming tuples. While the operation is trivial, the sample demonstrates how the StreamBase .NET Client library enables client applications to be created in a .NET-compatible language that runs with a StreamBase application.

Note

The .NET Client library and this sample are only available in the StreamBase installation for Microsoft Windows. You can run the pre-built samples without having Visual Studio .NET installed. However, they require version 4.0 or later of the .NET Framework, which can be downloaded from Microsoft's web site.

This topic describes the StreamBase .NET client sample.

This Sample's Files

The sample has the following files:

  • A StreamBase application, dotnet.sbapp.

  • One enqueuer and three dequeuer programs that use the StreamBase .NET Client library.

  • Microsoft Visual Studio .NET solution and project files, which can be used to build all of the sample source code. (In the Visual Studio project files, the paths to the StreamBase include files and libraries are configured for the standard default installation directory. You may need to adjust these paths for your PC.)

Running the .NET Client Sample

Running the .NET sample in StreamBase Studio

To run this sample using StreamBase Studio:

Note

Running the forms-based sample dequeuer, bin\SimpleDequeuerForm.exe, is not supported from StreamBase Studio.

  1. In the Package Explorer, double-click to open the dotnet.sbapp application. Make sure the application is the currently active tab in the EventFlow Editor.

  2. Click the Run button. This opens the SB Test/Debug perspective and starts the application.

  3. Open a StreamBase Command Prompt window, and navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above.

  4. In the Command Prompt window, run the enqueuer by typing:

    bin\SimpleEnqueuer.exe

  5. Back in Studio, observe that ten tuples appear in the Application Output view.

  6. In the Command Prompt window, run the dequeuer by typing:

    bin\SimpleDequeuer.exe or bin\SimpleDequeuerVB.exe

  7. Back in Studio, in the Manual Input view, fill in the three fields and click Send Data.

  8. Observe that a modified version of the tuple is dequeued by the simple dequeuer sample program running in the Command Prompt window.

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

Running the .NET sample in Command Prompt Windows

  1. Open three StreamBase Command Prompt windows. In each window, navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above.

  2. In window 1, run the StreamBase Server on dotnet.sbapp:

    sbd dotnet.sbapp

  3. In window 2, enter one of the following commands to run the dequeuer:

    • Console dequeuer command: bin\SimpleDequeuer.exe or bin\SimpleDequeuerVB.exe

    • Windows form-based dequeuer command: bin\SimpleDequeuerForm.exe

  4. If you are using the form-based dequeuer, click Connect.

  5. In window 3, enter the following command to run the enqueuer:

    bin\SimpleEnqueuer.exe

  6. Observe that tuples are displayed by the dequeuer. In the case of the form-based dequeuer, the last tuple dequeued is displayed.

  7. Run sbadmin shutdown to close the server.

Back to Top ^

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 permission problems. The default workspace location for this sample is:

studio-workspace/sample_dotnet

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

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