Contents
The TIBCO StreamBase® Adapter for Toronto Broadcast Feed (TBF) allows a StreamBase application to receive Securities Trading and Message Access Protocol (STAMP) market data messages from the Toronto Broadcast Feed (TBF) and TSXV Broadcast Feed (CBF). Each adapter instance can be configured for an equity feed, a reconciliation feed, or both. Each feed consists of two sessions: a feed session on which market data messages are received, and a recovery session used to request missed messages from the the STAMP server.
The adapter is embedded in the StreamBase application and has one input port and two or three output ports, depending on its configuration. The input port is used to send commands to the adapter from an input stream specifying dynamic changes in subscriptions or sequence numbers. The first output port emits status tuples to convey important adapter events, such as session and connection changes and errors processing feed messages. The remaining output ports emit tuples when market data messages are received on the equity and/or reconciliation feeds.
The adapter is configured through several properties in the adapter's Properties view in StreamBase Studio. These include the name of a resource file that configures the sessions for communicating with the STAMP server, a symbols file for subscribing to specific symbols at startup, check boxes that determine which of the two feeds the adapter reads, and schema editors for configuring the schemas of the equity and/or reconciliation output ports.
This section describes the properties you can set for this adapter, using the various tabs of the Properties view in StreamBase Studio.
In the tables in this section, the Property column shows each property name as found in several properties tabs of the Properties view for this adapter.
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.
Property | Description |
---|---|
Configuration File | The name of the file that configures the sessions for communicating with the STAMP server. |
Symbols File | The name of an optional symbols file for subscribing to specific symbols at startup. If no symbols file is specified, or the symbols file is empty, the adapter subscribes to all symbols. |
Filter Encrypted | If enabled, the adapter discards messages that cannot be decrypted. |
Wait For Input | If enabled, the adapter does not start receiving messages until input has been received on its control stream (input port). |
Log Level | Controls the level of verbosity the adapter uses to send notifications to the console. This setting can be higher than the containing application's log level. If set lower, the system log level is used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL. |
Property | Description |
---|---|
Receive Equity Feed | If enabled, the adapter enables an output port that emits a tuple for each equity feed message received. When this property is enabled, the corresponding schema editor in the Edit Schemas tab is enabled as well. |
Receive Equity Status/Reconciliation Feed | If enabled, the adapter enables an output port that emits a tuple for each equity status or reconciliation feed message received. When this property is enabled, the corresponding schema editor in the Edit Schemas tab is enabled as well. |
This tab shows you the fixed schema of the status output port. If the Equity Feed or Equity Status/Reconciliation Feed output ports are enabled, this tab provides a standard schema editor with which to specify the schemas of those ports.
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.
This section discusses how to use the TBF Input Adapter in a StreamBase application. As shown in the diagram below (depicting the adapter's sample application), the TBF adapter has one input port and up to three output ports to communicate with the surrounding application.
The TBF Input Adapter's ports are used as follows:
-
Input port, Command: This input port receives tuples used to subscribe to, or unsubscribe from, symbols after the adapter has started and to change the incoming or outgoing sequence numbers. The Subscribe port has the following schema:
-
command, string: Contains the name of the command to execute.
-
subscribe — The adapter subscribes to the symbol specified in the
symbol
field. -
unsubscribe — The adapter unsubscribes to the symbol specified in the
symbol
field. -
setSenderSequenceNumber — The adapter sets the outgoing (sender) sequence number for the session specified in the
session
field to the value specified in thesequenceNumber
field. -
setTargetSequenceNumber — The adapter sets the expected incoming (target) sequence number for the session specified in the
session
field to the value specified in thesequenceNumber
field.
-
-
session, string: Required only if the adapter is configured to connect to more than one feed session. Should contain a text value indicating the session type that the command is intended for, such as
EquityFeed
orReconFeed
. -
symbol, string: Required only if the command is
subscribe
orunsubscribe
. Specifies the symbol to subscribe or unsubscribe from. -
sequenceNumber, int: Required only if the command is
setSenderSequenceNumber
orsetTargetSequenceNumber
. Specifies the number that the sequence number for the sender or target should be set to.
-
-
Output port 1, Status: This output port emits status, information, and error tuples. The Status port has the following schema:
-
type, string: Contains one of the following values describing the type of event that occurred:
-
Session
-
Connection
-
Login
-
Feed Message
-
Process Tuple
-
Suspend/Resume
-
-
object, string: the name of the object associated with the event, such as the session created or logged in to, the contents of the feed message that wasn't processed successfully, or the name of the adapter that was suspended or resumed.
-
action, string: the action associated with the event, such as a login succeeding or adapter suspended/resumed.
-
message, string: A human-readable message string
-
-
Equity Feed Output port: If enabled, the adapter emits tuple on this port each time an equity feed message is received. The port's schema is derived from the Edit Schema tab of the adapter's Properties view. Equity feed message fields are mapped to tuple fields by case-sensitive name. Equity feed message fields not present in the schema of this port are discarded. Fields present in the output port schema but not in the equity feed schema are sent as null in the tuple.
-
Equity Status Feed/Reconciliation Feed Output port: If enabled, the adapter emits tuple on this port each time an equity status or reconciliation feed message is received. The port's schema is derived from the Edit Schema tab of the adapter's Properties view. Equity status or reconciliation feed message fields are mapped to tuple fields by case-sensitive name. Equity status or reconciliation feed message fields not present in the schema of this port are discarded. Fields present in the output port schema but not in the Equity status or reconciliation feed schema are sent as null in the tuple.
Add an instance of the adapter to a new StreamBase application as follows:
-
In StreamBase Studio, create a project, and create an EventFlow application file to host the adapter.
-
Drag an instance of the TBF Input Adapter from the Operators and Adapter drawer in the Palette view to the canvas.
-
Connect an input stream to the adapter's input port and configure the stream's schema with fields named
command
,session
,symbol
, andsequenceNumber
of types string, string, string, and int, respectively. -
Configure the schema of the equity and/or reconciliation output ports using the Edit Schema tab of the adapter's Properties view to match the set of fields expected in the corresponding feed messages.
-
Connect output streams to the adapter's two output ports.
-
Specify the name of a STAMP session configuration file and populate the file with the properties of the equity and/or reconciliation feed sessions and corresponding recovery sessions.
STAMP sessions are configured in a settings file consisting of one or more sections,
one for each session. Each section begins with a [session]
heading, indicating the settings for a new session follow.
Within a section, lines of the form Name=Value
define
the settings for the particular session. A section with a heading of [default]
provides default values for settings not explicitly
specified for a particular session.
The following table lists the set of STAMP sessions along with the valid and default values for each.
The TBF Input adapter uses typecheck messages to help you configure the adapter in your StreamBase application. In particular, the adapter generates typecheck messages when an invalid or no configuration file is specified, when an invalid symbols file is specified, when neither the equity feed and nor reconciliation feed is enabled, or when the scheme for an enabled feed has not been configured.
The adapter generates messages on the status port during runtime under various conditions, including:
-
A STAMP session is created.
-
The adapter logs in to a recovery session.
-
A connection to the STAMP server fails.
-
An error occurs in processing an incoming STAMP message.
-
The adapter is suspended or resumed.