Contents
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.
This section describes the properties you can set for this adapter, using the various tabs of the Properties view in StreamBase Studio.
Name: Use this required field to specify or change the name of this instance of this component, which must be unique in the current EventFlow 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.
Class name: Shows the fully qualified class name that implements the functionality of this adapter. If you need to reference this class name elsewhere in your application, you can right-click this field and select Copy from the context menu to place the full class name in the system clipboard.
Start options: This field provides a link to the Cluster Aware tab, where you configure the conditions under which this adapter starts.
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 Editor canvas, you can see the description by pressing Ctrl while the component's tooltip is displayed.
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 | 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. |
Use the settings in this tab to allow this operator or adapter to start and stop based on conditions that occur at runtime in a cluster with more than one node. During initial development of the fragment that contains this operator or adapter, and for maximum compatibility with TIBCO Streaming releases before 10.5.0, leave the Cluster start policy control in its default setting, Start with module.
Cluster awareness is an advanced topic that requires an understanding of StreamBase Runtime architecture features, including clusters, quorums, availability zones, and partitions. See Cluster Awareness Tab Settings on the Using Cluster Awareness page for instructions on configuring this 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.
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 |
-
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.
When you want to customize the output schema for the message, you must provide a descriptor file that compiles from a Google Protobuf proto (both proto2 and proto3 are supported).
You can generate the descriptor file from the command line:
protoc protoFile.proto --descriptor_set_out=descFile.desc
Below is a proto file example:
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; } }