protobuf

BETA: This component is experimental and therefore subject to change outside of major version releases.

Performs conversions to or from a protobuf message. This processor uses reflection, meaning conversions can be made directly from the target .proto files.

# Common config fields, showing default values
protobuf:
operator: to_json
message: ""
import_path: ""

The main functionality of this processor is to map to and from JSON documents, you can read more about JSON mapping of protobuf messages here: https://developers.google.com/protocol-buffers/docs/proto3#json

Using reflection for processing protobuf messages in this way is less performant than generating and using native code. Therefore when performance is critical it is recommended that you use Benthos plugins instead for processing protobuf messages natively, you can find an example of Benthos plugins at https://github.com/benthosdev/benthos-plugin-example

Operators

to_json

Converts protobuf messages into a generic JSON structure. This makes it easier to manipulate the contents of the document within Benthos.

from_json

Attempts to create a target protobuf message from a generic JSON structure.

Fields

operator

The operator to execute

Type: string
Default: "to_json"
Options: to_json, from_json.

message

The fully qualified name of the protobuf message to convert to/from.

Type: string
Default: ""

import_path

A path to a .proto file, or directory containing all .proto files required for parsing the target message. If left empty the current directory is used.

Type: string
Default: ""

parts

An optional array of message indexes of a batch that the processor should apply to. If left empty all messages are processed. This field is only applicable when batching messages at the input level.

Indexes can be negative, and if so the part will be selected from the end counting backwards starting from -1.

Type: array
Default: []