Types mappingTypes described in the Avro specification have to be mapped to types present in the Platformsystem. You can find the mapping in the table below: Avro type | Corresponding MZ type |
---|
null | null | boolean | boolean | int | int* | long | long* | float | float* | double | double* | string | string | record | AvroRecordUDR | enum | AvroEnumUDR | fixed | AvroFixedUDR |
Note |
---|
*Numeric types need casting while preparing data for encoding. See Avro Decoder Example example to see the usage. |
UDRsThe following UDRs should be used while working with Avro Decoder/Encoder AvroDecoderUDRAvroDecoderUDR is used as an input for Avro Decoder. The following fields are included in the AvroDecoderUDR : Field | Description |
---|
data (bytearray) | This field contains a binary encoded avro message payload. This should be just a message payload without any metadata. | readerSchemaID (string) | Avro Reader SchemaID - ID of the compatible schema used for reading data | writerSchemaID (string) | Avro Writer SchemaID - schema used for encoding the message |
DynamicAvroUDRDynamicAvroUDR is an output of Avro Decoder. It consists of only one field called data . The type of data field depends on a schema used for decoding operation. It can be both primitive or complex type. See https://infozone.atlassian.net/wiki/spaces/MD92/pages/182648833/Avro+Types+and+UDRs#Types-mapping for mapping Avro types to MediationZone the internal type.
Info |
---|
Example If type of the top element in a schema is record then the field type of data will be AvroRecordUDR and if type is string then the field type of data will be string. |
See Avro Decoder Example to see an example usage of this UDR. The following fields are included in the DynamicAvroUDR : Field | Description |
---|
data (any) | Contains content decoded using a decoder |
AvroEncoderUDRAvroEncoderUDR is used as an input for Avro Encoder. The following fields are included in the AvroEncoderUDR : Field | Description |
---|
data (any) | This field contains a UDR/type to be encoded using a selected schema | writerSchemaID (string) | Avro Writer SchemaID - schema used for encoding the message |
AvroEnumUDRAvroEnumUDR is used to represent Enum avro type. The following fields are included in the AvroEnumUDR : Field | Description |
---|
fullname (string) | Name of the enum field (example “example.avro.myFixed”) | symbol (string) | Selected value of the specific enum type |
AvroFixedUDRAvroFixedUDR is used to representive Fixed avro type. The following fields are included in the AvroFixedUDR : Field | Description |
---|
bytes (bytearray) | Byte value of the field | fullname (string) | Name of the fixed field (example “example.avro.myFixed”) |
AvroRecordUDRAvroRecordUDR is used to represent Avro Record structure. The following fields are included in the AvroRecordUDR : Field | Description |
---|
fields (map<string,any>) | Map containing fields of the record. | fullname (string) | Name of the record including the namespace (example “example.avro.User3”) |
|