Samples Guide Contents

StreamBase sample applications help you learn how to design EventFlow applications. The tables of available samples below are organized in the same categories found the Load StreamBase Sample dialog.

Topic Description
Loading Samples in Studio Using the FileLoad StreamBase Sample dialog.
StreamBase Component Exchange Locating more examples in the StreamBase Component Exchange.

Application Samples

This sample category includes EventFlow applications that focus on basic StreamBase functionality and solving business problems.

Topic Description
Authentication Sample Demonstrates what happens when you enable StreamBase authentication and then try to use certain sb* StreamBase commands, such as sbadmin shutdown.
Best Bids and Asks Sample Shows an example of a common stock trading application that tracks the highest bid price and lowest ask price for each stock.
Bollinger Band Sample Shows an example of a common analytical tool that provides a relative definition of high and low bands in securities trading.
Deployment File Sample Includes a simple, multi-container application that demonstrates how two StreamBase deployment files can be used to run the same top-level application with different sub-modules for different purposes.
Error Streams Sample Demonstrates how to use Error Ports and Streams.
FeedProc Sample Shows an example of an application that processes financial tick data from three financial feeds, performing various useful computations on the data.
First Application Sample Use this sample while stepping through the tutorial in the Getting Started Guide. The tutorial is designed for first-time StreamBase Studio users.
Interfaces Sample Demonstrates how to use StreamBase interfaces to enforce a set of stream and schema definitions, and to use different implementations of the same interface for different purposes.
Loop Sample Demonstrates how to use a simple loop in an EventFlow application.
MACD Sample Shows an example of a momentum indicator: a program that follows trends and shows the relationship between two moving averages of prices.
Output Filtering Sample Demonstrates the use of output filtering to allow StreamBase client applications to receive only the tuples that they are supposed to receive, based on a keyword.
Round Robin Dequeuer Sample Demonstrates the use of round robin robin dequeuer applications, which control the destination of output tuples based on the connected clients, so that each output message is delivered to a single, subscribed client.

Client Library Samples

This sample category demonstrate how to work with the StreamBase Client libraries to create client programs.

Topic Description
Buffering Sample Highlights the tuple buffering options for producer or enqueue clients.
Client Sample Provides sample enqueue and dequeue clients; that is, enqueuing (adding) tuples onto a named stream, and dequeuing (reading) processed tuples from a named stream. The samples include both Java or C++ sources.
StreamBase .NET Client Sample Provides sample .NET enqueue, dequeue clients, and a monitor client that displays system, operator, and thread information. This sample requires the StreamBase .NET Client library, which is installed only for Windows.
ReadTable API Sample Provides sample Java code that illustrates the new StreamBaseClient.ReadTable() method, which is used to display all or a specified number of rows from a Query Table or Materialized Window.
TableOperator Java Client API Sample Provides sample Java code that illustrates the use of methods in the TableAccessor class, which lets Java operators and adapters interact with Query Tables. In particular, this class lets you insert and replace rows, read a single row based on the primary index, perform more complex multi-row queries, delete rows, and truncate entire tables.
Client Status Monitor Sample Demonstrates how to monitor the status of StreamBase clients using the Java Client API. The sample provides a Java application that runs a StreamBase client and tracks its connection status in four ways.

Data Construct and Operator Samples

The operator sample group illustrates all StreamBase operators in the Palette view, one sample per operator. The JDBC Query sample requires site-specific configuration and is thereby provided in a separate sample.

Topic Description
Operator Sample Group Provides one small EventFlow application for each operator and most data constructs in the Palette view in StreamBase Studio, and illustrates the use of StreamBase deployment files to define the modules to be run by an Extension Point operator.
JDBC Table Data Construct Sample Demonstrates the Query operator when associated with a JDBC Table data construct. The EventFlow application in this sample cannot pass typechecking until you configure the sample to connect to an actual JDBC database at your site.
Runtime Schema Cast Operator Sample Demonstrates the Runtime Schema Cast operator, which casts its input schema to its configured target output schema at run time.
XML to Tuple and Tuple to XML Operator Sample Demonstrates the Tuple to XML and XML to Tuple operators.
XML Normalizer Operator Sample Demonstrates the XML Normalizer operator.
Capture Fields for Generic Data Store Sample Demonstrates how to use a capture field in the schema of a Query Table to make that table reusable with variable schemas in different copies of its containing module.
Capture Fields and Parent Schemas Sample Demonstrates how to use capture fields in conjunction with parent schemas to create a reusable module that can match orders for FX trading in one instance and can match orders for Equities trading in another copy of the identical, unchanged module. The module uses abstract schemas for its input stream and Query Table that become concrete schemas in actual use.

Extending StreamBase Samples

You can extend StreamBase by writing your own custom clients, functions, embedded adapters, and Java operators, as illustrated in this category of samples.

Topic Description
Custom Java Simple Function Sample Shows how to provide a custom simple function written in Java.
Custom C++ Simple Function Sample Shows how to provide a custom simple function written in C++.
Custom Java Aggregate Function Sample Shows how to provide a custom aggregate function written in Java.
Custom C++ Aggregate Function Sample Shows how to provide a custom aggregate function written in C++.
Java Operator Sample Shows how to provide a custom operator written in Java. Shows a simple StringCase class that extends the StreamBase Client API's Operator class.
Custom Embedded Adapter Sample Shows how to provide a custom embedded adapter.
Drools Operator Sample Shows how to use the Drools operator to integrate a business rule interpreted by the Drools Core rules engine.
Feed Simulation Custom Reader Sample Shows how to provide custom file reader functionality to the feed simulation mechanism.
Microsoft .NET Operator Sample Shows how to use the Microsoft .NET operator to integrate .NET code into your StreamBase application.
Using Logback Using Logback as a logging back-end to StreamBase logging.
Using Log4j Using Log4j as a logging back-end to StreamBase logging.

High Availability Samples

This category of samples demonstrate best practices for implementing highly available clusters of StreamBase Servers. They show how to separate the high availability logic from the rest of the application logic, and show design patterns you can use to address specific high-availability requirements. The samples also demonstrate how to specify automatic high availability, and how to set the properties for a Query Table to use automatic table replication.

Topic Description
High Availability Sample

The HA sample shows how to enable automatic high availability for two StreamBase Server instances running together in a Hot/Warm high-availability cluster. The sample runs the same simple application in two servers, one designated primary and the other designated secondary. There are two parts to the sample: a basic sample and custom sample. There is also an application that you can run to examine how the HA Heartbeat adapter works.

High Availability Finite State Machine Sample

The HA FSM sample shows the use of a Finite State Machine (FSM) to deal with state transitions in an HA design pattern. The behavior of the sample is similar to the behavior of the HA Sample, but the implementation of the HA FSM sample is more powerful and complex. Also, unlike the HA sample, leadership status is not based on a setting in the startup script. The server that starts first is designated as the leader, and any server that starts next is the nonleader.

High Availability Shared Disk Access Sample This sample shows:
  • How to ensure that an application is running on one of two servers, where the application requires access to a disk-based Query Table.

  • How to test for the presence of an application in another container and start the application if it is not found.

  • How to use the External Process operator to run commands specific to high availability design patterns.

This sample requires StreamBase Enterprise Edition with a license that enables the use of disk-based Query Tables.

Query Table Replication Sample This sample shows the use of automatic table replication by setting properties for a Query Table and using the configuration file for the servers. The sample also shows a design pattern for table replication in the same setup without using automatic table replication. The design pattern is two servers in a high availability (HA) cluster. The schemas in the sample table are order schemas typically used in an application for trading.

Native Database Connectivity Adapter Samples

This sample category illustrates how to use the adapters that provide connectivity to certain databases using high performance database-native drivers provided by the database vendor, as opposed to standard JDBC connectivity.

Topic Description
Sybase RAP Load Adapter Sample Sybase RAP Load adapter (deprecated)
Vertica Load Adapter Sample Vertica Load adapter

StreamBase Market Data Adapter Samples

Topic Description
ActivFeed Input Adapter Sample Activfeed input adapter
Alpha Trading System EMAPI Market Data Feed Adapter Sample Alpha Trading Systems Market Data Feed adapter
Bloomberg BPOD Adapter Sample Bloomberg BPOD input adapter
Bloomberg Server API/Managed BPipe Adapter Sample Bloomberg Server API/Managed B-Pipe input adapter
BM&FBOVESPA UMDF Input Adapter Sample BM&FBOVESPA UMDF input adapter
CME Market Data Platform FIX/FAST Input Adapter Sample CME Market Data Platform FIX/FAST input adapter
Deutsche Bank AutobahnFX Trading System Adapter Sample Deutsche Bank AutobahnFX Trading System adapter
Digitec D3 Streaming Interface Adapter Sample Digitec D3 Streaming Interface adapter
EBS Live XML Input Adapter Sample EBS Live XML adapter
Exegy Adapter Sample Exegy Input and Monitoring adapters
FIX Adapter Sample FIX adapter
FXall Relationship Trading Customer Adapter Sample FXall Relationship Trading Customer adapter
FXall Relationship Trading Provider Adapter Sample FXall Relationship Trading Provider adapter
GAIN GTX Adapters Sample GAIN GTX adapter
Hotspot FX Trading System Adapter Sample Hotspot FX Trading System adapter
Hotspot Itch Input Adapter Sample Hotspot Itch Trading System adapter
InfoReach TMS Adapter Sample InfoReach TMS adapter
Interactive Data PlusFeed Input Adapter Sample Interactive Data PlusFeed input adapter
Lime Citrius Quote Input Adapter Sample Lime Citrius Quote input adapter
MarketFactory Adapters Sample MarketFactory Enhanced Market Data and Trading adapters
Morningstar Quotes Feed Adapter Sample Morningstar Quotes Feed adapter
TBF Input Adapter Sample TBF input adapter
Thomson Reuters Enterprise Platform for Real-Time Subscribing Input Adapter Sample Thomson Reuters Enterprise Platform for Real-Time Subscribing input adapter
Thomson Reuters Enterprise Platform for Real-Time Publishing Output Adapter Sample Thomson Reuters Enterprise Platform for Real-Time Publishing output adapter
Thomson Reuters Enterprise Platform for Real-Time Contribution Output Adapter Sample Thomson Reuters Enterprise Platform for Real-Time Contribution output adapter
Thomson Reuters Velocity Analytics Samples Sample group for the Thomson Reuters Velocity Analytics Broadcast Server input adapter, the Velocity Analytics UTSS output adapter, and query operations against the Velocity Analytics time series data store.
Wombat MAMA Input Adapter Sample Wombat Subscribing input adapter
Wombat MAMA Output Adapter Sample Wombat Publishing output adapter

StreamBase Messaging Adapter Samples

Topic Description
29West LBM Adapter Sample 29West LBM input and output adapters
Apache Flume Input and Output Adapters Sample Apache Flume input and output adapters
IBM WebSphere MQ Adapter Sample IBM WebSphere MQ input and output adapters
JMS Input And Output Adapters Sample JMS Embedded input and output adapters
Tervela Adapter Sample Tervela input and output adapters
TIBCO Rendezvous Adapter Sample TIBCO Rendezvous input and output adapters
Wall Street Systems Adapter Sample Wall Street Systems input and output adapters

StreamBase Standard Adapter Samples

Topic Description
Binary File Reader/Writer Adapter Sample Binary file input and output adapters
CSV File Reader Input Adapter Sample CSV File input adapter
CSV File Writer Output Adapter Sample CSV File output adapter
CSV Socket Reader Input Adapter Sample CSV Socket input adapter
CSV Socket Writer Output Adapter Sample CSV Socket output adapter
File Reader Input Adapter Sample File Reader input adapter
E-mail Sender Output Adapter Sample E-mail sending output adapter
Feed Simulation Input Adapter Sample Feed Simulation input adapter
HTTP Reader Input Adapter Sample HTTP Reader input adapter
IRC Reader Input Adapter Sample IRC Reader input adapter
Log Output Adapter Sample Logging output adapter
Once Input Adapter Sample Once input adapter
POP3 Reader Input Adapter Sample POP3 Reader input adapter
Regular Expression File Reader Input Adapter Sample Regular Expression File input adapter
Regular Expression Socket Reader Input Adapter Sample Regular Expression Socket input adapter
RSS Reader Input Adapter Sample RSS Reader input adapter
SMTP Reader Input Adapter Sample SMTP (E-mail) Reader input adapter
StreamBase to StreamBase Input Adapter Sample StreamBase-to-StreamBase Input and Output adapters
StreamBase Monitor Adapter Sample StreamBase Monitor input adapter
Web Reader Input Adapter Sample Web Reader input adapter
XML File Writer Output Adapter Sample XML File output adapter
XML Over HTTP Output Adapter Sample XML-over-HTTP output adapter

StreamBase Trade Execution Adapter Samples

Topic Description
Alpha Trading System EMAPI Order Entry Adapter Sample Alpha Trading Systems Order Entry adapter
Deutsche Bank AutobahnFX Trading System Adapter Sample Deutsche Bank AutobahnFX Trading System adapter
FIX Adapter Sample FIX adapter
FXall Relationship Trading Customer Adapter Sample FXall Relationship Trading Customer adapter
FXall Relationship Trading Provider Adapter Sample FXall Relationship Trading Provider adapter
GAIN GTX Adapters Sample GAIN GTX adapter
Hotspot FX Trading System Adapter Sample Hotspot FX Trading System adapter
InfoReach TMS Adapter Sample InfoReach TMS adapter
MarketFactory Adapters Sample MarketFactory Enhanced Market Data and Trading adapters

StreamBase Visualization Adapter Samples

Topic Description
Microsoft Excel Legacy Adapter Sample Microsoft Excel legacy external adapter