Bloomberg Server API Input Adapter

This adapter is part of the TIBCO StreamBase CEP Connectivity Package.

Introduction

The TIBCO StreamBase® Adapter for Bloomberg Server API is an embedded adapter that can connect to a Bloomberg Server API process to subscribe and get data from the process.

Configuration

The adapter can be configured to connect to a Bloomberg service that supports subscriptions to receive subscription data and send it downstream. The service name and connection details can be configured in the adapter properties.

The adapter can be configured to connect to the server two ways:

  • It can connect at startup time.

  • It can connect to the server only when it receives a connect command through its input port.

If the adapter is configured to connect on startup, it will attempt to establish server connection when it starts up. If the server is down or if the adapter cannot establish a connection for other reasons, it will keep retrying until it succeeds. Once the connection is established, it will proceed to connect to the required services and subscribe for data, if configured to do so. If the server goes down or if the adapter otherwise loses the connection afterwards, it will keep trying to reestablish the connection until it succeeds. A connect command does not have any effect at this time. A disconnect command will disconnect from the server, if it is currently connected, and will not attempt to reconnect until it receives a connect command. If the adapter receives a disconnect command when it is not connected to the server, it will stop trying to establish connection, until it receives a further connect command.

If the adapter is not configured to connect on startup, it will wait to receive a connect command on its input port before it attempts to establish connection with the server. Once it receives the connect command, it will keep trying to establish the connection until it succeeds or until it receives a disconnect command.

Adapter Ports

The adapter has one input port and three output ports, as shown in the diagram below.

Input Ports

The Commands input port is used to send commands to the adapter to connect/disconnect from the server, subscribe/unsubscribe for data, or to request metadata including information about Bloomberg data fields.

The Command input port has the following schema:

  • Command, string

  • SubscriptionParameters, tuple

    • Topic, string

    • Options, string

  • FieldParameters, tuple

    • Id, string

    • SearchSpec, string

    • ProductType, string

    • FieldType, string

SubscriptionParameters contain fields that should be used when subscribing or unsubscribing for data. FieldParameters contain fields that should be used when requesting for information about Bloomberg data fields.

Supported commands are:

  • Connect: Connects to the Bloomberg server. This command does not take any additional parameters.

  • Disconnect: Disconnects from the Bloomberg server. This command does not take any additional parameters.

  • Subscribe: Subscribes to the specified topic. Topic value must be specified with the Subscribe command. The topic value must conform to topic as specified in Bloomberg API Developer's Guide. If Options value is specified, it will be used to override any default options specified in the adapter properties tab. If the adapter is already subscribed to the specified topic, a resubscribe will be issued to avoid losing any updates.

  • Unsubscribe: Unsubscribes from the specified topic. Topic value must be specified with the Unsubscribe command.

  • ListSubscriptions or ListSub: Lists the currently active subscriptions. This command does not take any additional parameters. The subscriptions will be output through Metadata output port.

  • FieldInfo: This command may be used to get more information about Bloomberg data fields. Field information will be output through the Metadata output port. Id or SearchSpec must be specified when using this command. Multiple values may be specified for Id separated by commas. If Id value is specified, list of Bloomberg fields whose mnemonic or alphanumeric ids exactly match the specified values will be output. If SearchSpec is specified, list of fields matching the SearchSpec value will be output. The value will be used to search across mnemonics, descriptions and definitions. The field search may be further narrowed by specifying ProductType and/or FieldType. For more information, please refer to API Field Information Service section of Bloomberg's BLPAPI Developer's Guide.

Output Ports

The adapter has three output ports:

  • Status: Output is produced on this port to notify of changes in connection and subscription status and to indicate error in input commands. Status output port has the following schema:

    • type, string: Contains one of the following values that describes the type of event that occurred:

      • Session

      • Service

      • Subscription

      • User Input

      • Suspend/Resume

    • object, string: the object associated with the event, such are connection destination or subscription string.

    • action, string: the action associated with the event, such as Connected, Disconnected or Subscription Failed.

    • message, string: a human readable message string.

  • Metadata: This output port is used to emit output for ListSubscriptions and FieldInfo commands. This output port has the following schema:

    • Subscriptions, tuple

      • SubscriptionString, string

      • CorrelationID, string

    • FieldsResult, tuple

      • FinalResult, boolean

      • FieldsResult

        • Id, string

        • Mnemonic, string

        • DataType, string

        • Description, string

        • Category, string

        • FieldError, string

    Subscriptions field in the schema is used to list the active subscriptions. FieldsResult field is used to list the Bloomberg fields that the user searched for. The boolean FinalResult is used to indicate if this is the final set of results of the fields search request.

  • MarketData: This output port emits the data that the user subscribed for. The schema of this port will contain SubscriptionString and CorrelationID fields, in addition to the fields specified by the user using Edit Schema tab.

Adapter Properties

This section describes the properties you can set for this adapter, using the tabs of the Properties view in StreamBase Studio.

The tables in this section have a Property column that shows each property name as found in the one or more adapter properties tabs of the Properties view.

Use the StreamSQL names of the adapter's properties when using this adapter in a StreamSQL program with the APPLY JAVA statement.

General Tab

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 Name: 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 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 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 start the component with StreamBase Manager. With this option 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

Property Data Type Default Description StreamSQL Property
Connect on Startup check box Selected

Leave this selected if you would like the adapter to connect to the Bloomberg server when the adapter starts up. Uncheck this if the adapter should connect to the Bloomberg server only on receiving a connect command on its input port.

ConnectOnStartup
Enable command input port check box Selected

Uncheck this if the input port will not be used at all. In this case, all subscriptions must be made using Initial Subscriptions property.

EnableCmdInput
Bloomberg Server Host string None

The host name of the Bloomberg server

ServerHost
Bloomberg Server Port int None

The port number of the Bloomberg server

ServerPort
Service Name string None

The name of the service that the adapter should use to subscribe for data

ServiceName
Default Topic Prefix string None

The default topic prefix that should be used in subscriptions when no prefix is specified by user while subscribing

DefaultTopicPrefix
Default Subscription Options string None

The default options to be used in subscriptions when no options are specified by user while subscribing

DefaultOptions
Log Missing Output Fields check box Unselected

If the subscription data received from Bloomberg contains fields other than the ones specified by the user using Edit Schema tab, a warning log message may be logged. Check this option, if a warning message should be logged about missing output fields.

LogMissingOutputFields
Log Level drop-down list INFO 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 will be used. Available values, in increasing order of verbosity, are: OFF, ERROR, WARN, INFO, DEBUG, TRACE, and ALL. LogLevel

Initial Subscriptions Tab

Property Data Type Default Description StreamSQL Property
Initial Subscriptions map of (string, string) None Specify the subscriptions to process at start up time here. Zero or more subscriptions may be specified. Topic must be specified. Options is optional. InitialSubscriptions

Edit Schema Tab

Property Data Type Default Description StreamSQL Property
Edit Schema schema None The fields that should be included in the output produced by the adapter must be specified here. These fields will be used by the adapter as the fields of interest at subscription time. OutputSchema

The StreamBase field types specified for the fields must be compatible with the Bloomberg field type. If a Bloomberg field cannot be converted to the specified type, a warning message will be logged at startup. However, the adapter will still try to process the subscriptions to the best it can. See the table below for the valid conversions. Bloomberg types that are not listed in the table are not allowed.

Bloomberg Type Valid StreamBase Types
BOOL boolean, int, long, double, string
CHAR int, long, double, string
DATE timestamp, string
DATETIME timestamp, string
FLOAT32 double, string
FLOAT64 double, string
INT32 int, long, double, string
INT64 long, string
STRING string
TIME timestamp, string

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.

Suspend and Resume Behavior

On suspend, the adapter will stop processing any subscription data that it receives from the Bloomberg server. However, the events will stay in the queue, so that they will be output by the adapter when it resumes.

On resumption, the adapter will continue to process the events in its event queue.