TIBCO Output Adapter for Google Protocol Buffers

Introduction

The TIBCO StreamBase® Output Protobuf Adapter(Protobuf for short) converts the input tuple into protobuf typed byte array based on a custom format that you provide.

User could either provide a .desc file describing the desired message type, or by default the system will auto generate an internal descriptor based on the input tuple's schema.

Adapter Properties

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

General Tab

Name: Use this required field to specify or change the component's name, which must be unique in the current module. 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.

Start with application: If this field is set to Yes (default) or to a module parameter that evaluates to true, this instance of this adapter starts as part of the JVM engine that runs this EventFlow fragment. If this field is set to No or to a module parameter that evaluates to false, the adapter instance is loaded with the engine, but does not start until you send an epadmin container resume command (or its sbadmin equivalent), or until you start the component with StreamBase Manager.

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 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 Type Description
File Name resource chooser A customized Google protobuf file in .desc style.
Message Index int Each descriptor file could contain more than one message type; this index specifies which message type will be used. If no file provided above, this is disabled.
Timestamp Format string Determines timestamp format of StreamBase data type Timestamp.
Protobuf Bytes Output Field Name string The name of the bytes field in the output tuple which contains the protobuf byte[] converted from the input tuple.
Log Level drop-down list 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.

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.

Data Input Port

The data port is the default input port for the Protobuf2Tuple adapter, and is always enabled. Use the data port to convert tuple data to the Protobuf type byte array.

The data type comparison table:

Protobuf Data Type StreamBase Data Type
STRING STRING
DOUBLE/FLOAT DOUBLE
BOOLEAN/STRING BOOL
INT64 LONG
INT64 DOUBLE
MESSAGE TUPLE
INT32 INT
BYTE_STRING BLOB
LONG/STRING TIMESTAMP

Data Output Port

  • With descriptor file: the output schema will be generated based on the provided file.

  • Without descriptor file: an internal descriptor will be generated based on the input tuple schema.

  • Blob output: Protobuf type Byte array containing all needed message info will be added to the output data.

Customized Descriptor

When you want to customize the output schema for the message, you must provide a descriptor file that compiles from a Google Protobuf proto.

And the descriptor file can be generated by command line:

protoc protoFile.proto --descriptor_set_out=descFile.desc

Below is an example of proto file:

syntax = "proto3";
import "google/protobuf/descriptor.proto";
        
message Input {
    string name = 1;
    int32 id = 2;  // Unique ID number for this person.
    Address add = 3;
    repeated PhoneNumber phones = 4;  //List
        
    message PhoneNumber {
        string number = 1;
    }
        
    message Address {
        string zip = 1;
        string street = 2;
    }
}