Feed Simulation Input Adapter

Introduction

The TIBCO StreamBase® Feed Simulation Input adapter is an embedded adapter that uses Feed Simulation configuration files to define the adapter's output ports and their schemas, and to determine what data is emitted from each adapter port. Feed simulation configuration files are created with the StreamBase Feed Simulation Editor as described in Using the Feed Simulation Editor. Feed simulation configuration files can be used interchangeably with this Feed Simulation adapter and with the command line tool, sbfeedsim. Any data sources, generation methods, and emission rates can be used with either this adapter or the command line tool.

The Feed Simulation Editor uses stream names, each with a defined schema, to represent output streams. The Feed Simulation adapter creates an output port for each stream in the configuration file, using the defined schema as the output schema.

The first output port of the adapter is always a status port. Each subsequent output port of the adapter represents a stream defined in the feed simulation configuration file, in the order in which they appear in the Editor.

An optional control input port is available for pausing and resuming, as defined below.

Properties

General Tab

The Feed Simulation input adapter has the following properties on the General tab in its Properties View in StreamBase Studio:

Name: Use this field to specify or change the component's name, which must be unique in the application. The name must contain only alphabetic characters, numbers, and underscores, and no hyphens or other special characters. The first character must be alphabetic or an underscore.

Adapter: A read-only field that shows the formal name of the adapter.

Class: A field that shows the fully qualified class name that implements the functionality of this adapter. Use this class name when loading the adapter in StreamSQL programs with the APPLY JAVA statement. You can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.

Start with application: If this field is set to Yes or to a module parameter that evaluates to true, an instance of this adapter starts as part of the containing StreamBase Server. If this field is set to No or to a module parameter that evaluates to false, the adapter is loaded with the server, but does not start until you send an sbadmin resume command, or until you start the component with StreamBase Manager. With this option set to No or false, the adapter does not start even if the application as a whole is suspended and later resumed. The recommended setting is selected by default.

Enable Error Output Port: Select this check box to add an Error Port to this component. In the EventFlow canvas, the Error Port shows as a red output port, always the last port for the component. See Using Error Ports and Error Streams to learn about Error Ports.

Description: Optionally enter text to briefly describe the component's purpose and function. In the EventFlow canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.

Adapter Properties Tab

The Feed Simulation adapter has the following properties on the Adapter Settings tab in its Properties View in StreamBase Studio:

Property Data Type Description
Feed Simulation File string The name of the feed simulation configuration file to use, which must be present on the resource search path. The number of output ports and their schemas are defined in this file.
Enable Control Port check box If selected, this setting adds an input port to the adapter with the schema and meanings defined below.
Report Period integer value Specifies the number of seconds to elapse before emitting a control tuple that contains the number of data tuples sent since the last control tuple. Zero means never report.
Wait for Start Command check box If selected, the simulation does not start until a start command is received on the control port.
File Name Field string The name in the input schema that specifies the file to load. If empty this feature is disabled.
Log Level Drop-down list Controls the level of verbosity the adapter uses to issue informational traces to the console. This setting is independent of the containing application's overall log level. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL.

Concurrency Tab

Use the Concurrency tab to specify parallel regions for this instance of this component, or multiplicity options, or both. The Concurrency tab settings are described in Concurrency Options, and dispatch styles are described in Dispatch Styles.

Caution

Concurrency settings are not suitable for every application, and using these settings requires a thorough analysis of your application. For details, see Execution Order and Concurrency, which includes important guidelines for using the concurrency options.

Ports

The Feed Simulation input adapter always has a status output port, which is always the first output port. Subsequent output ports are added for each data stream defined in the feed simulation configuration file. The number of data stream output ports, and their schemas, are completely determined by the supplied feed simulation configuration file.

The schema of the status output port is defined as follows:

Field Data Type Description
Type string The basic state reported, always one of the following:
CONTROL
INFO
ERROR
Object string The name on the EventFlow canvas of the adapter reporting the status.
Action string The action that occurred, one of the following:
INITIALIZING SUSPEND
STARTING RESUME
CONTINUING COMPLETE
LASTNUMTUPLES  

The LASTNUMTUPLES action contains the number of data tuples emitted for the most recent Report Period.

Message string A human-readable string that provides additional context for the status message.
Time timestamp The time the action occurred.

By default, the Feed Simulation input adapter has no input ports. You can optionally add a control port by checking the Enable Control Port property.

The schema of the control input port is defined as follows:

Field Data Type Description
command string The basic state reported, always one of the following, which are not case sensitive:
start — start the simulation, if not already started.
stop — stop the simulation.
suspend — suspend all simulation outputs.
resume — resume all simulation outputs.
load — load a new simulation file at runtime, the new file must exist, must match the same output schema as the existing feed simulation, and all resource required must be available. If the Wait for Start Command property is enabled the new file will not start until a start command is sent. The load command will automatically perform a stop command before initializing the new file.
scale — rate multiplier applied against the tuple emission rates currently in use.
maxtuples — send no more than the number of tuples specified in the value field.
maxtime — emit tuples for no longer than the number of seconds specified in the value field.
value or scale double Only used with the scale, maxtuples, and maxtime commands.

For scale, specifies the rate multiplier to apply; for example, use a scale of 2 to emit tuples at twice the normal rate. Specify -1 to have the simulation run as fast as possible. Specify 0 to reset the fast-as-possible state and return to the previous rate.

filename string Only used with the load command.

This value determines the new feed simulation file to load.

Typechecking and Error Handling

Typechecking fails if the feed simulation configuration file cannot be found, or if referenced resources such as CSV files cannot be found.

Suspend and Resume Behavior

On suspend, the Feed Simulation input adapter finishes processing the current simulation window (10 ms by default), and then pauses.