Datasports on Software Development

Articles and updates from Datasports about the craft of software

Tuple Identity and Lifetime

leave a comment »

1. Introduction

The graphical nature of EventFlow applications and the metaphor of streams of tuples flowing through operators and adapters, naturally gives rise to a mental model of tuples that is not strictly correct, and a potential barrier to correct understanding of how tuples are processed in the StreamBase platform.

This article provides a brief overview of tuple lifetime and identity that is meant to clarify understanding of what a tuple is, what it does, and for how long.
Read the rest of this entry »

Written by datasports

Oct 10, 2011 at 5:40 PM

Posted in Tutorials

Thoughts on Encapsulation Schemes, Part 2

with 3 comments

1. Introduction

As discussed in the Part 1 of this article, StreamBase provides a variety of hosting mechanisms for .sbapp modules. Each of these mechanisms has its own set of options related to synchronicity and concurrency, which will be the focus of this article.

A big part of the win with the visual editing of StreamBase EventFlow logic is the ease with which threading models can be specified, modified, and tuned. In general, little more is required than to select a component or module and specify some concurrency parameters. Moving logic into or out of different processing threads is as simple as moving logic into and out of modules. In my experience, this is a huge productivity gain over traditional programming environments such as .NET or J2EE. Developers can begin by getting logic correct, then make targeted changes to tune the concurrency/threading settings to maximize performance where needed.

Of course, with this great power comes great responsibility. The ease of changing these settings means that no application is more than a few checkboxes away from bad performance due to thread-thrashing, or logic errors due to race conditions. This article will survey the different options and present some guidelines, but it will always be the responsibility of the application developer to gather the metrics, analyze the logic, and provide the insight necessary to ensure correct and high-performance behavior. Those analytical skills are not so different from what would be applied in other environments, but the big win with StreamBase is that the plumbing is all taken care of for you.
Read the rest of this entry »

Written by datasports

Oct 5, 2011 at 7:02 PM

Posted in Best Practices

Thoughts on Encapsulation Schemes, Part 1.

leave a comment »

1. Introduction

StreamBase has a set of related features which allow the quick and relatively painless refactoring of logic into modules, and several mechanisms for reusing those modules in your code. These are very powerful features which are an important part of what makes StreamBase development so productive compared to other environments like .NET or J2EE.

Despite being incredibly powerful and flexible, the mechanisms for encapulating and re-using logic, and the many options related to concurrency are accessible and straightforward to use. While the StreamBase platform handles an incredible amount of plumbing that would otherwise fall to the application developer, due care must still be taken to ensure that the correct approach is taken to ensure correct behavior with the highest possible performance.

This article will provide an overview of the many different combinations of hosting types as well as present some heuristics about when the different approaches make sense.

This discussion considers encapsulation schemes along two axes: hosting types (discussed in this article), and concurrency settings (discussed in Part 2 of this article). Not every possible combination is valid, but in general the type of hosting and the concurrency options are independent.
Read the rest of this entry »

Written by datasports

Oct 4, 2011 at 10:46 PM

Posted in Best Practices

Datasports WebServiceListener Adapter

with one comment

1. Overview

NOTE: This article documents a component that is available via the StreamBase Component Exchange (SBX).

The Datasports WebServiceListener adapater is a sample adapter that shows how to create an input adapter which exposes a webservice. It is not a general-purpose component as-is, since the webservice interface is not particularly useful and is specified in code. It is meant as a guide or tutorial used in conjunction with this article.

The adapter features a configurable URI for the webservice, optional run time control interface, and a webservice that exposes 2 methods, with a corresponding output port for each. A remote call to either webmethod results in a tuple being sent out from the corresponding output port. The methods signatures are:

	
public boolean NewMessage(String notificationMessage)
public boolean SetValue(String key, String value)

Both methods return a boolean indicating success in processing the call. For instructional and experimental purposes, both methods will fail (and return false) if the first parameter contains the string literal “FAIL” (case insensitive).

In addition to the adapter project and a StreamBase application that contains it, this package includes both Java and .Net clients for testing. The Java client is a non-GUI application with hard-coded test values, the .Net client is a WinForms application that lets the user enter parameters, invoke methods, and see results through a GUI.
Read the rest of this entry »

Written by datasports

Nov 16, 2010 at 8:07 PM

Posted in Adapters, SBX, Tutorials

Datasports DirectoryWatcher Adapter

with one comment

1. Overview

NOTE: This article documents a component that is available via the StreamBase Component Exchange (SBX).

The Datasports DirectoryWatcher adapter is a general-purpose solution to perform a common task – watch a directory structure and raise events (in the form of StreamBase tuples) when changes occur in that directory structure. These changes include creation, update, deletion, and re-naming of files and directories.

The adapter makes use of the JNotify library, a cross-platform Java library released under the GNU Library or Lesser General Public License (LGPL) which uses a set of native libs to hook into the OS on Windows, Linux, and Mac OS.

This article will document the creation and usage of the adapter. The source for the adapter and a test application which uses it is available from the StreamBase Component Exchange. To load it, choose File | StreamBase Component Exchange…, and type DirectoryWatcher in the “Find in Title” field. Check the checkbox beside the title of the project, and choose Finish. This will import the project with all source into your current StreamBase Studio Workspace.
Read the rest of this entry »

Written by datasports

Sep 27, 2010 at 5:06 PM

Posted in Adapters, SBX, Tutorials