StreamBase to StreamBase Input Adapter

Introduction

The TIBCO StreamBase® SBD-to-SBD Input (Downstream) Adapter runs within a downstream application, reading tuples from an upstream application. It is suitable for situations in which multiple data consumers — downstream applications — wish to read data from a single producer. The consumers can be stopped and started independently without affecting the producer.

The adapter is configured with the host name and port of the upstream application as well as the name of the stream or streams to read from. The adapter is configured by default to reconnect after a restart of the upstream application.

Adapter Properties Tab

The following table explains the adapter properties that you can set in the Adapter Settings tab of the Properties view for an SBD2SBDInput icon in the EventFlow canvas.

Property Data Type Description
Upstream host string The host name or IP address of the upstream application.
Upstream port string The TCP port number of the upstream application.
Upstream container string The name of the container in the upstream application that holds the Upstream stream designated in the previous field. The default entry is default.
Reconnect Interval (secs) int The period, in seconds, the downstream application waits between reconnection attempts after the upstream application fails or no compatible stream is present. Set this property to zero to disable reconnection; the default value is 10 seconds. When reconnection is disabled and no control port is used, the upstream application must be started first and must have a compatible output stream from which the downstream application can read.

Note

When specifying a reconnection interval as part of a container connection from a remote host, specify the interval value in milliseconds, not seconds. See Remote Container Connection Parameters.

Use SSL check box Select this check box if the connection to the upstream host uses secure SSL-based communication to the upstream server.
Authentication type drop-down list Specifies the type of authentication to use when connecting to the upstream server. Options in the drop-down list are: No authentication, Basic authentication, and Client certificate authentication.
User name string For secure connections, the login name on the upstream host to authenticate as. Only one of User name or Keystore pathname can be specified.
Keystore file pathname string The path on the local machine to the file containing keystore information used for Client certificate authentication.
Password string The password for the User name or the keystore passphrase.
Schema matching two-option radio buttons

Identical structure required means that, in the schemas of the outgoing and incoming streams, each field must match in data type and sequence, but the field names do not have to match. For fields of type tuple, their fields must also match in type and sequence.

Match field names, the default setting, means that fields in the outgoing stream are matched by name against fields in the incoming stream. Fields whose names match must have the same data type in both streams. Any fields in the outgoing schema whose names don't match the incoming schema are not streamed. Any fields in the incoming schema whose names don't match anything in the incoming schema are set to null.

For example, consider an outgoing stream with schema (a int, b (x int, y int, z int)) that is connected to an incoming stream with schema (b (y int, z int), c int). The incoming stream does not see fields a or b.x. Fields b.y and b.z are passed from incoming to outgoing, and field c in the incoming stream is set to null.

Capture Transform Strategy radio button The strategy to use when transforming capture fields for this operator: FLATTEN or NEST.
Explicit URI (Advanced) string This option is for advanced users who have a standard StreamBase URI they use in other parts of the StreamBase application. Use this option to paste in a full StreamBase URI to the upstream application, including security connection information. If this field is used, the following fields must be blank: Upstream host, Upstream port, Upstream stream, Upstream container, User name, Keystore file pathname, and password.
Enable event port check box Select this check box to enable a second output port that receives connection-up and connection-down events. The schema of the event output port is as follows:
  • EventType — Connection or Status

  • Object — For EventType Connection, this field contains the URL of the upstream server instance. For EventType Status, this field contains the adapter canvas name.

  • Action — contains UP or DOWN to indicate the state of the connection with the upstream server.

  • Info — contains a human-readable description of the event, such as Connection to sb://localhost:10001 is UP

Connect on adapter init check box Selected by default. When selected, or no control port is enabled, the adapter attempts to connect to the other server during adapter start-up. When cleared, the adapter connects to the other server when a connect tuple is received on its control input port.
Enable control port check box Cleared by default. When selected, an additional input port is created, used to control and request status of the adapter. See below for more on this input port.
Low Latency check box Cleared by default. When selected, the adapter configures itself to minimize data latency by disabling buffering, Nagle algorithms, and so on.
Log Level INFO 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.

Streamn Tabs

The StreamBase to StreamBase input adapter has ten tabs in the Properties view labeled Stream 1 through Stream 10. The ten tabs have the same configuration options, one for each upstream connection. You must configure the Upstream stream field for the Stream 1 tab. Configure other fields and other Stream tabs as required.

Property Data Type Description
Upstream stream string The name of the stream to read from in the upstream application. If no stream with this name is present in the upstream application, or the stream's schema is incompatible with the schema configured in this tab, the downstream application behaves as though the upstream application is inaccessible. The Reconnect Interval property determines whether the downstream application attempts to reconnect periodically until a compatible stream is present.
Filtered Subscribe Expression string If empty, the filtered subscription option is not used for this stream, and the adapter passes all tuples. To use a filtered subscription, enter a StreamBase expression that narrows the tuples passed by the adapter to those matching the expression. You can specify a different filter predicate for each Stream tab.

For example, when connecting to a stream whose schema contains a string field named symbol, you can narrow the tuples passed by this adapter instance to those matching tuples for one stock using an expression such as symbol="IBM". For another example, you might be using this adapter to connect to a server that replays a day's tick information in the event of a dropped server connection; use an expression in this field to pass only the tuples since the connection dropped.

Schema Field specification grid Specify the schema for this stream, using the standard schema field grid.

Adapter Port Schemas

Output ports

The StreamBase to StreamBase input adapter has a configurable number of output ports that are configured by setting the output schemas in the Stream 1 through Stream 10 tabs.

Control Input Port

If you select the Enable control port option, an input port is added to the adapter for use as a control port. The first field of the control port schema must be a string field named command. This port is used to send the following commands to the adapter:

  • connect — The adapter tries to connect to the configured upstream host. If configured to reconnect, it continues to try to connect at the configured reconnect interval until it succeeds.

  • disconnect — The adapter disconnects from the upstream host. It does not try to reconnect, even if a reconnect interval is configured.

  • status — The adapter emits a status tuple on the event port, if configured.

Typechecking and Error Handling

Typechecking fails if the Upstream Host or Upstream Stream properties are empty or if the Upstream Port property contains an illegal TCP port number (unless the Explicit URI field is used).

The behavior in response to errors depends upon the setting of the Reconnect Interval property. When configured to reconnect, the downstream application polls periodically until the upstream application is accessible and contains an output stream with an identical name and schema. Otherwise, the downstream application emits an error message and makes no further attempts to connect to the upstream application.

Suspend and Resume Behavior

When suspended, the adapter stops reading tuples from the upstream application. Note that doing so may cause the upstream application to drop the connection with the downstream application, resulting in lost tuples. Upon resuming, the adapter reconnects to the upstream application, if necessary and configured to do so, and begins reading tuples. If the adapter is configured not to reconnect with the upstream application and the connection is dropped during the suspension, the application will not dequeue tuples from the upstream application upon resume.

However, note that when the container enqueue (dequeue) control is set explicitly to ENABLED from any other state (DISABLED, DROP_TUPLES, or even ENABLED), the StreamBase-to-StreamBase adapter will then start (enter a STARTED state), regardless of the adapter's Start with application setting.