This topic describes the XML structure of the StreamBase feed simulation
configuration file, .sbfs. To create a feed simulation
file, see the Using the Feed
Simulation Editor topic.
Note
The current XML format was introduced in StreamBase 3.7 and supersedes
the format used in previous StreamBase releases. You can upgrade any
legacy .sbfs configuration file (created in
StreamBase 3.5 and earler) by opening and saving it in the current
StreamBase Studio, or by using the sbfeedsim --convert command.
Legacy feed simulation .sbfs files can still be run
using the sbfeedsim-old command as
described in StreamBase
Legacy Feed Simulation Configuration XML. For more information on upgrading a
legacy feed simulation file, see Upgrading Legacy Feed Simulations in the Test/Debug
Guide.
sbfs:Simulation is the root element for a
StreamBase feed simulation configuration. It has the following child
elements:
-
One or more of:
SimStreams
Example 1. Simulation
<?xml version="1.0" encoding="ASCII"?>
<sbfs:Simulation xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:sbfs="http://www.streambase.com/SBFS">
<SimStreams Name="Orders" Description="Stock Orders">
...
</SimStreams>
<SimStreams Name="TradesIn" Description="Test trade data feed">
...
</SimStreams>
</Simulation>
When you generate an
file in StreamBase, the Simulation element and by inheritance, all child
elements, are qualified with the unique sbfssbfs namespace.
Identifies a load on a single stream. Has the following child elements:
-
One of:
ProcessingOptions -
One of:
Schema
Example 2. SimStreams
The following example defines a data source and schema for one stream of a feed simulation.
<SimStreams Name="Orders" Description="v">
<ProcessingOptions DataRatePerSecond="1.0" DataGenerationMethod="DataFile">
<DataSource Name="toys.csv" DataSourceURI="toys.csv"/>
</ProcessingOptions>
<Schema>
<Fields Name="Category" DataTypeName="string" FieldLength="32">
<Distribution/>
<DataSourceMapping/>
</Fields>
<Fields Name="Item" DataTypeName="string" FieldLength="32">
<Distribution/>
<DataSourceMapping DestFieldNum="2"/>
</Fields>
<Fields Name="Quantity" DataTypeName="int" FieldLength="4">
<Distribution/>
<DataSourceMapping DestFieldNum="3"/>
</Fields>
</Schema>
</SimStreams>
Attributes
| Attribute | Required | Description |
|---|---|---|
| Name | Yes | The unique name of an input stream to the feed simulation. |
Specifies how data will be supplied to the feed simulation input streams. Has the following child elements:
-
Zero or one of:
DataSource
Attributes
| Attribute | Required | Description |
|---|---|---|
| DataRatePerSecond | No | The rate in seconds at which tuples should run through this stream. Default: 10. |
| DataGenerationMethod | No |
The method by which data will be fed to this stream. One of the
following:
|
| DataGenRateMethod | No |
The method by which the data rate is determined. One of the following:
|
| TimeStampColumn | No | If DataGenRateMethod="TimestampFromColumn", the number of the column in the data file whose timestamp value will be used. |
| UseFirstValueAsStartTime | No |
If TimeStampColumn is used, the value to be used as the start time. One
of:
|
| LogToInput | No |
Specifies whether the generated feed simulation data will be shown in the
SB Test/Debug perspective's Application Input view. One of the following:
|
| MaxTuples | No |
The number of tuples to process during the simulation. If you omit the
attribute or use it with the default value of 0, there is no limit: all input data is processed.
|
| MaxTime | No |
The maximum time (in seconds) that the simulation should run. If the
attribute is not used or used with the default value of 0, there is no limit: the simulation runs until stopped.
|
Example 3. ProcessingOptions at 1 TPS
The following example shows settings for a feed simulation that uses an external data file and runs at one tuple per second (system time).
<ProcessingOptions DataRatePerSecond="1.0" DataGenerationMethod="DataFile">
Example 4. ProcessingOptions at 11 TPS
In the next example we customized data and an external data file. It runs at 11 tuples per second, based on timestamp fields in the data file instead of system time.
<ProcessingOptions DataRatePerSecond="11.0" TimeStampColumn="1" DataGenerationMethod="Custom"
DataGenRateMethod="TimestampFromColumn">
<DataSource Name="DataSource" DataSourceURI="toys.csv"/>
</ProcessingOptions>
If DataGenerationMethod attribute="DataFile" in the
ProcessingOptions element, use this element to identify the file that will be used
to feed data to the feed simulation.
Attributes
| Attribute | Required | Description |
|---|---|---|
| Name | Yes | A label identifying the data file. |
| DataSourceURI | Yes | The file-based URI of the data source, such as the location of myfile.csv that... |
Schema has the following child elements:
-
One or more of:
Fields
Defines a field in a schema. Has the following child elements:
-
Zero or one of:
Distribution -
Zero or one of:
DataSourceMapping
Attributes
| Attribute | Required | Description |
|---|---|---|
| Name | Yes | A unique identifier for the field in the schema. |
| DataTypeName | Yes | The data type of the field. Valid values are int, long, double, string, boolean, and timestamp. |
| FieldLength | Yes | The length of the field in bytes. |
Defines how generated data are distributed in fields. Recognized at runtime only when you specify DataGenerationMethod="Custom" in the ProcessingOptions element. Has the following child elements:
-
Zero or one of:
EnumeratedDist
Attributes
| Attribute | Required | Description |
|---|---|---|
| GenerationMethod | Yes |
The type of field data to be generated. One of the following:
|
| NumRandomEnumValues | No |
If GenerationMethod="Enumerated",
generates a specified number of random values of equal weight.
|
| EnumeratedDistMethod = "SpecifiedValues" | No |
If GenerationMethod="Enumerated", enables
you to specify a list of values and weights. Use together with child
element EnumeratedDist.
|
| ConstantValue | No |
If GenerationMethod="Constant", specifies
the constant value to generate.
|
| MinValue | No |
If GenerationMethod="Incremented",
specifies the smallest value in the incremented range.
|
| MaxValue | No |
If GenerationMethod="Incremented",
specifies the largest allowed incremented value.
|
| StartValue | No |
If GenerationMethod="Incremented",
specifies the value at which to begin incrementing.
|
| Delta | No |
If GenerationMethod="Incremented",
specifies the number by which the value increases at each iteration.
|
| NullProbability | No |
If GenerationMethod="Incremented", defines
the probability that a null value will be generated by the Feed
Simulator for this field, as part of the runtime feed simulation.
|
| Cycle | No |
If GenerationMethod="Incremented",
specifies what happens when the field increments beyond the MaxValue.
By default (if you omit the attribute), nothing occurs; if you set
Cycle="true", the values are reset and the
increment cycle is repeated.
|
Example 7. Distribution
The following example includes Distribution elements in several Fields
elements (not shown). In the first instance, the Distribution element is
empty: as a result, only default attribute values are used. The second
instance defines how custom values will be incremented. The remaining
instances show some of the other available attributes. For an additional
example, see EnumeratedDist.
<Distribution/> ... <Distribution GenerationMethod="Incremented" MinValue="1.145454281485E12" MaxValue="9.999999999999E12" StartValue="1.145454281486E12"/> ... <Distribution GenerationMethod="Uniform" MinValue="20.0" MaxValue="800.0"/> ... <Distribution GenerationMethod="Constant" ConstantValue="2"/> ... <Distribution GenerationMethod="Random" MinValue="20.0" MaxValue="25.0" StartValue="22.0" Delta="0.1"/>
If GenerationMethod="Enumerated", use this element
to list each customized field, defining its value and relative priority
(weight).
Attributes
| Attribute | Required | Description |
|---|---|---|
| value | Yes | The value of the enumerated field. See the example. |
| weight | No | The weight of the field relative to other enumerated fields. This setting influences how often the field's value is used in the generated tuples. The default weight is 1.0; that is, all values are weighted equally by default. |
Example 8. EnumeratedDist
In the following configuration example, the ITEM_NAME field is given enumerated values:
<Fields Name="ITEM_NAME" DataTypeName="string" FieldLength="10">
<Distribution GenerationMethod="Enumerated" EnumeratedDistMethod="SpecifiedValues">
<EnumeratedDist weight="1.0" value="CEREAL"/>
<EnumeratedDist weight="1.0" value="MILK"/>
<EnumeratedDist weight="2.0" value="EGGS"/>
</Distribution>
</Fields>
If DataGenerationMethod="DataFile" in the
ProcessingOptions element, add this element in each Fields element to correlate
the fields in your schema to the columns in your DataSource file.
Attributes
| Attribute | Required | Description |
|---|---|---|
| DestFieldNum | Yes, after the first field | Specify a column number in the data file that corresponds to the schema field. The default value is 1, so the first instance of the element can be empty. |
Example 9. DataSourceMapping
In the following configuration example, we map each data file column number to a field in the schema. Notice that the first instance of DataSourceMapping is empty: it implicitly maps column 1 to the Category field.
<Schema>
<Fields Name="Category" DataTypeName="string" FieldLength="32">
<Distribution/>
<DataSourceMapping/>
</Fields>
<Fields Name="Item" DataTypeName="string" FieldLength="32">
<Distribution/>
<DataSourceMapping DestFieldNum="2"/>
</Fields>
<Fields Name="Quantity" DataTypeName="int" FieldLength="4">
<Distribution/>
<DataSourceMapping DestFieldNum="3"/>
</Fields>
</Schema>
