Adobe Flex Output Adapter Sample

This sample demonstrates the use of the Adobe Flex Output Adapter. The sample consists of two parts: a network monitoring StreamBase application and a Flex client application that displays monitored results.

Note

The Adobe Flex Output adapter is deprecated as of StreamBase release 7.2.5 and will be removed in a future release.

The StreamBase application is driven by a custom input adapter that simulates IP network activity. The adapter emits tuples periodically representing network connections composed of a source and destination IP address and a TCP protocol value. Aggregate operators then generate per-IP-address and per-protocol counts over various time-based windows. The results are fed into the Flex adapter for display by the Flex client application.

The Flex application contains several panels, each displaying a stream of data from the StreamBase application. Various Flex chart types are used, including a bar chart, an area chart, and a pie chart.

The sample also demonstrates use of the control stream to feed data from the Flex client to the StreamBase application. Changes to a speed-control slider on the client are sent via the Flex adapter to an input port of the IP simulator adapter, affecting the rate at which tuples representing simulated IP traffic are emitted.

Importing This Sample into StreamBase Studio

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

  • From the top menu, click FileLoad StreamBase Sample.

  • Select this sample from the Embedded Adapters list.

  • Click OK.

StreamBase Studio creates a single project containing the sample files.

Sample Location

By default, the sample files are installed in:

On Windows

C:\Program Files\StreamBase Systems\StreamBase.n.m\sample\adapter\embedded\flexserver\

On UNIX

/opt/streambase/sample/adapter/embedded/flexserver/

When you load the sample into StreamBase Studio, Studio copies the sample project's files to your Studio workspace. StreamBase Systems recommends that you use the workspace copy of the sample, especially on UNIX, where you may not have write access to /opt/streambase. In the default installation, the path to this sample in your Studio workspace is:

UNIX:       
  ~/streambase-studio-n.m-workspace/sample_adapter_embedded_flexserver
Windows XP:
  C:\Documents and Settings\username\My Documents\StreamBase Studio n.m Workspace\
      sample_adapter_embedded_flexserver
Windows 7 and Windows Vista:
  C:\Users\username\Documents\StreamBase Studio n.m Workspace\
      sample_adapter_embedded_flexserver

Prerequisites

  • Make sure you have the Adobe Flash Player version 9 or later installed on your system. You can obtain the Flash Player for Windows and Linux from http://www.adobe.com.

  • Make sure Flash player is enabled as an add-on in your web browser.

Running This Sample in StreamBase Studio

  1. Open a web browser that has the Flash player enabled as an add-on.

  2. Outside of Studio, open Windows Explorer on Windows and navigate to the directory where the sample is installed, or to your workspace copy of the sample, as described above. Go to the bin subdirectory.

    On UNIX, use your favorite file browser such as Nautilus, and navigate to this sample's bin directory, as above.

  3. The bin directory contains a single Flash file, netmon.swf. Drag the netmon.swf file to the web browser. This browser now contains the Flash-based network monitor application, but without any activity showing.

  4. In StreamBase Studio, in the Package Explorer, double-click to open the flex.sbapp application. Make sure the application is the currently active tab in the EventFlow Editor.

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

  6. Return to your web browser and invoke its refresh function. The Flash network monitoring application now shows activity being fed from the running StreamBase application.

  7. When done, press F9 in Studio or click the Stop Running Application button.

Running This Sample in a Terminal Window

This section describes how to run the 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.

  1. Open two terminal windows on UNIX, or two StreamBase Command Prompts on 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. For Windows, follow steps 1 through 3 of the previous section to start your web browser running the netmon.swf Flash program.

  3. For UNIX, in window 1, navigate to the bin subdirectory of the sample's directory. Start a Flash-enabled web browser with the Flash file as an argument. For example:

    firefox ./netmon.swf
    
  4. In windows 2, start the sample StreamBase application by typing:

    start sbd -f flex.sbconf flex.sbapp
    

    Observe the following message indicating the Flex adapter is waiting for incoming connections from Flex clients:

    [notice] StreamBase Flex Adapter: Waiting to accept incoming connections on port 20000

  5. Return to your web browser and invoke its refresh function. The Flash network monitoring application now shows activity being fed from the running StreamBase application.

  6. In window 1, run sbadmin shutdown to close the server.