Operator AvroToJSON

Primitive operator image not displayed. Problem loading file: ../../image/tk$com.ibm.streamsx.avro/op$com.ibm.streamsx.avro$AvroToJSON.svg
This operator converts binary Avro messages and optionally message keys into a JSON string. The operator has two operation modes::
  • Avro Schema Embedded: The operator processes a blob which contains one or more Avro messages and has the schema embedded. This is the pattern when Avro objects are read from a file (either local file system or HDFS). Every Avro object in the blob is converted to JSON and then submitted to the output port. This operation mode is entered if both parameters avroMessageSchemaFile and avroKeySchemaFile are not existing or have an empty value.
  • No Avro Schema Embedded: The operator processes an Avro Blob containing a single message and with no embedded schema. This is the pattern when Avro objects are passed over messaging infrastructure such as Apache Kafka. This operation mode is entered if one or both parameters avroMessageSchemaFile and avroKeySchemaFile are specified.
If an input or output message or key attribute is not found or has an incompatible type, the operator will fail. This operator must not be used inside a consistent region.

Summary

Ports
This operator has 1 input port and 1 output port.
Windowing
This operator does not accept any windowing configurations.
Parameters
This operator supports 6 parameters.

Optional: avroKeySchemaFile, avroMessageSchemaFile, inputAvroKey, inputAvroMessage, outputJsonKey, outputJsonMessage

Metrics
This operator does not report any metrics.

Properties

Implementation
Java

Input Ports

Ports (0)

Port that receives the Apache Avro data blocks. Window punctuation markers are passed to the output port.

Properties

Output Ports

Assignments
Java operators do not support output assignments.
Ports (0)

Port that produces tuples with the JSON message string and optionally with the JSON key string. Window punctuation markers are forwarded from the input port.

Properties

Parameters

This operator supports 6 parameters.

Optional: avroKeySchemaFile, avroMessageSchemaFile, inputAvroKey, inputAvroMessage, outputJsonKey, outputJsonMessage

avroKeySchemaFile

File that contains the Avro schema to deserialize the binary Avro key. If this parameter is non empty, the operator works in mode No Avro Schema Embedded.

Properties
avroMessageSchemaFile

File that contains the Avro schema to deserialize the binary Avro message. If this parameter is non empty, the operator works in mode No Avro Schema Embedded.

Properties
inputAvroKey

The input stream attribute which contains the input Avro key blob. This attribute must be of type blob. If not specified, the default attribute is avroKey.

Properties
inputAvroMessage

The input stream attribute which contains the input Avro message blob. This attribute must be of type blob. Default is the sole output attribute when the schema has one attribute otherwise avroMessage.

Properties
outputJsonKey

The output stream attribute which contains the output JSON key string. This attribute must be of rstring or ustring type. If not specified, the default attribute is jsonKey.

Properties
outputJsonMessage

The output stream attribute which contains the output JSON message string. This attribute must be of rstring or ustring type. Default is the sole output attribute when the schema has one attribute otherwise jsonMessage.

Properties

Libraries

Operator class library
Library Path: ../../impl/lib/com.ibm.streamsx.avro.jar, ../../opt/downloaded/*