Defining Input Streams

Topics:

Introduction

Input streams are shown on the left side of an EventFlow. They define an entry point into a StreamBase application, and declare the starting schema of the inbound data. You can define one or more input streams in an application. You can create a new schema or copy an existing one from any application that is visible in your Package Explorer.

The name and schema you assign to an input stream are used by the StreamBase Server to determine whether data from clients and external sources should be enqueued onto that stream. The StreamBase Server can listen for requests from a client source, such as the Manual Input View in the SB Test/Debug perspective, an sbfeedsim command, or a producer client that you create based on the StreamBase Client API. The data can also arrive via an adapter that converts third-party protocols into the StreamBase protocol.

Note

Tuple output produced by an operator, if then consumed as input to another operator, is also considered to be an input stream that was generated within the application at runtime. These intermediate input streams, also called arcs, are automatically named by StreamBase Studio.

Normally, schemas are defined within the StreamBase application. However, you can also save a schema separately, then reuse it in another component or another StreamBase application. See Using Saved Schemas for details.

The rest of this topic describes the actions you can take on each tab of the input stream Properties view.

General Tab

Name: Every application component must have a unique name. Use this field to specify or change the component's name. 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.

Description: Optionally, enter a description 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.

Edit Schema Tab

Use this tab to define the input stream's schema:

  1. Use the control at the top of the Edit Schema tab to choose the schema type:

    Private schema

    Populate the schema fields using one of these methods:

    • To define the fields manually, use the Add button at the top of the tab to add a row for each schema field. Enter values for the Field Name and Type, and if necessary, the Size. The Description is optional. For example:

      Field Name Type Size Description
      symbol string 10 Stock symbol
      quantity int 4 Number of shares

      The name must begin with an alphabetic character or an underscore, can contain only alphabetic characters, numbers, and underscores, and cannot contain hyphens or other special characters.

      The type must be one of the supported StreamBase Data Types. The editor fills in the size for data types with fixed sizes, but you must enter a valid size for strings and blobs, which are variable-length.

    • You can reuse an existing schema whose fields are appropriate for this component and your application. It can be a schema that you previously saved, one that you imported from your file system (as described in Importing and Exporting Resources), or one that exists in another application. To do so, click the Copy Schema button. If prompted to save the application at this point, click Yes to continue.

      In the Copy Schema dialog, identify the schema you want. See Copying Schemas for details.

      The schema fields are loaded in your Fields table.

      Tip

      Alternatively, you can drag a saved schema from the Saved Schemas view and drop it onto the schema table in the Edit Schema tab. If you already have entries in the table, StreamBase prompts for permission to replace them with the contents of the schema you are copying.

    In addition to the Add button, you can use the Remove, Move Up, and Move Down buttons to edit and order your schema fields. If you have copied a schema, remember that this is a local copy: Any changes you make here do not affect the original schema that you copied.

    Named schema

    If you have previously defined any named schemas for this application, you can choose one from the list. (If no named schemas exist, only the Private Schema option is available.)

    When you choose a named schema, its fields are loaded into the Fields table. The text is grey and cannot be edited here.

    Tip

    You can change a named schema by editing it in the Named Schemas tab of your application's EventFlow Editor.

  2. Optionally, document your schema in the Schema Description field.