Debugger Breakpoints Sample

This sample consists of a Studio project containing a single module file intended to illustrate a few basic features of EventFlow Debugger breakpoints.

The application is a simple design with two branches. Tuple flow depends on the value of the branch field you provide for input tuples in the Test/Debug perspective. Sending top routes that tuple into the OutBranchTop output stream. Any other value for branch sends tuples to the OutBranchBottom stream.

Before you run the sample, you must create some breakpoints at which to stop during execution. You can add a breakpoint to any arc by selecting it and then either by right-clicking and selecting Toggle breakpoint from the context menu or by typing Ctrl+Shift+B. When you add a breakpoint, a round dot appears on the arc to indicate it.

For more information on debugging in StreamBase Studio, see Using the EventFlow Debugger.

Importing This Sample into StreamBase Studio

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

  • From the top-level menu, click File>Import Samples and Community Content.

  • Enter break to narrow the list of options

  • Select Setting breakpoints from the Client Libraries category.

  • Click Import Now.

StreamBase Studio creates a project for the sample.

Running This Sample in StreamBase Studio

  1. In the Project Explorer view, open the sample you just loaded.

    If you see red marks on a project folder, wait a moment for the project to load its features.

    If the red marks do not resolve themselves after a minute, select the project, right-click, and select Maven>Update Project from the context menu.

  2. Open the src/main/eventflow/packageName folder.

  3. Double-click to open DebuggerBreakpoints.sbapp.

  4. Place a breakpoint on the top arc between the Sequence and NoOp operators, as described above.

  5. Place another breakpoint on the bottom arc between the Sequence2 and NoOp2 operators.

  6. Make the bottom breakpoint conditional by following these steps:

    1. Right-click the bottom breakpoint and select Breakpoint Properties from the context menu.

    2. Select Hit count and type 3 in the field next to it.

    3. Click Apply and Close.

  7. Click the Debug button. This opens the SB Test/Debug perspective and starts the module in debugging mode.

  8. In the Input Streams view, enter top in the branch field, any string value in the payload field, and click Send Data.

    Execution suspends when the top breakpoint receives the tuple, highlighting the tuple's path in blue. Also, the Variables view opens, displaying the tuple's values and dynamic variable and query table values for you to inspect.

  9. To continue execution, click the Resume button or press F8. The tuple flows to the Output stream OutBranchTop and highlighting is removed from the diagram.

  10. In the Input Streams view again, replace top in the branch field with any other string, enter any string value in the payload field, and click Send Data.

    The debugger does not activate until you send data three times to the lower branch. Then the data path to the lower breakpoint highlights and the Variables view again displays data values.

    Note

    If you resume execution and continue to send tuples to the lower branch, its breakpoint does not activate again, because you configured it to respond to the third tuple only. However, the next time you debug the application, the breakpoint resets and once again halts execution at the third tuple.

  11. When done, press F9 or click the Terminate EventFlow Fragment button.

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_breakpoints

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