JsonToAvroBinaryPostExecuter
Configuration file |
None. Configuration is done directly with a string in field "Config file". |
Class name |
com.ebd.hub.datawizard.postexec.JsonToAvroBinaryPostExecuter |
Description
This postexecuter can encode data in the "AVRO" format using a schema file and is primarily used for this purpose in conjunction with the Response "Kafka" (see there), but can also be used with others.
The path to the schema file is specified in field "Config file".
Example
Schema
{
"name"
:
"complexOuterRecord"
,
"type"
:
"record"
,
"fields"
:
[
{
"name"
:
"primitiveNull"
,
"type"
:
"null"
},
{
"name"
:
"primitiveBoolean"
,
"type"
:
"boolean"
},
{
"name"
:
"primitiveInt"
,
"type"
:
"int"
},
{
"name"
:
"primitiveLong"
,
"type"
:
"long"
},
{
"name"
:
"primitiveFloat"
,
"type"
:
"float"
},
{
"name"
:
"primitiveDouble"
,
"type"
:
"double"
},
{
"name"
:
"primitiveBytes"
,
"type"
:
"bytes"
},
{
"name"
:
"primitiveString"
,
"type"
:
"string"
},
{
"name"
:
"complexNestedRecord"
,
"type"
:
[
"null"
,
{
"name"
:
"complexInnerRecord"
,
"type"
:
"record"
,
"fields"
:
[
{
"name"
:
"innerRecordPrimitiveInt"
,
"type"
:
[
"null"
,
"int"
]
},
{
"name"
:
"innerRecordPrimitiveString"
,
"type"
:
[
"null"
,
"string"
]
}
]
}
]
},
{
"name"
:
"complexEnumValue"
,
"type"
:
{
"name"
:
"complexEnumType"
,
"type"
:
"enum"
,
"symbols"
:
[
"LEAVES"
,
"ACORNS"
,
"BELLS"
,
"HEARTS"
]
}
},
{
"name"
:
"complexArrayValue"
,
"type"
:
{
"name"
:
"complexArrayType"
,
"type"
:
"array"
,
"items"
:
"int"
,
"default"
: []
}
},
{
"name"
:
"complexMapValue"
,
"type"
:
{
"name"
:
"complexMapType"
,
"type"
:
"map"
,
"values"
:
"string"
,
"default"
: {}
}
},
{
"name"
:
"complexFixedValue"
,
"type"
:
{
"name"
:
"complexFixedType"
,
"type"
:
"fixed"
,
"size"
:
1
}
},
{
"name"
:
"complexUnionValue"
,
"type"
:
[
"null"
,
"string"
]
},
{
"name"
:
"logicalDecimal"
,
"type"
:
{
"type"
:
"bytes"
,
"logicalType"
:
"decimal"
,
"precision"
:
3
,
"scale"
:
1
}
},
{
"name"
:
"logicalUUID"
,
"type"
:
{
"type"
:
"string"
,
"logicalType"
:
"uuid"
}
},
{
"name"
:
"logicalDate"
,
"type"
:
{
"type"
:
"int"
,
"logicalType"
:
"date"
}
},
{
"name"
:
"logicalDurationValue"
,
"type"
:
{
"name"
:
"logicalDurationType"
,
"type"
:
"fixed"
,
"logicalType"
:
"duration"
,
"size"
:
12
}
},
{
"name"
:
"logicalTimeMillis"
,
"type"
:
{
"type"
:
"int"
,
"logicalType"
:
"time-millis"
}
},
{
"name"
:
"logicalTimeMicros"
,
"type"
:
{
"type"
:
"long"
,
"logicalType"
:
"time-micros"
}
},
{
"name"
:
"logicalTimestampMillis"
,
"type"
:
{
"type"
:
"long"
,
"logicalType"
:
"timestamp-millis"
}
},
{
"name"
:
"logicalTimestampMicros"
,
"type"
:
{
"type"
:
"long"
,
"logicalType"
:
"timestamp-micros"
}
},
{
"name"
:
"logicalLocalTimestampMillis"
,
"type"
:
{
"type"
:
"long"
,
"logicalType"
:
"local-timestamp-millis"
}
},
{
"name"
:
"logicalLocalTimestampMicros"
,
"type"
:
{
"type"
:
"long"
,
"logicalType"
:
"local-timestamp-micros"
}
}
]
}
Data
{
"primitiveNull"
:
null
,
"primitiveBoolean"
:
true
,
"primitiveInt"
:
2134567890
,
"primitiveLong"
:
9123456789012345678
,
"primitiveFloat"
:
1
.39e-
45
,
"primitiveDouble"
:
1
.79301e308,
"primitiveBytes"
:
"randomTextAsBytes"
,
"primitiveString"
:
"iamjustatest"
,
"complexNestedRecord"
:
{
"complexInnerRecord"
:
{
"innerRecordPrimitiveInt"
:
{
"int"
:
4
},
"innerRecordPrimitiveString"
:
{
"string"
:
"innerRecordStringValue"
}
}
},
"complexEnumValue"
:
"LEAVES"
,
"complexArrayValue"
:
[
1
,
2
,
3
],
"complexMapValue"
:
{
"firstEntry"
:
"first"
,
"secondEntry"
:
"second"
},
"complexFixedValue"
:
"\u00aa"
,
"complexUnionValue"
:
{
"string"
:
"union"
},
"logicalDecimal"
:
"\u00FF"
,
"logicalUUID"
:
"ad0677ab-bd1c-4383-9d45-e46c56bcc5c9"
,
"logicalDate"
:
1643886644
,
"logicalDurationValue"
:
"\u0000\u1111\u2222\u3333\u4444\u5555\u6666\u7777\u8888\u9999\uaaaa\ubbbb"
,
"logicalTimeMillis"
:
7739955
,
"logicalTimeMicros"
:
11223344
,
"logicalTimestampMillis"
:
998877
,
"logicalTimestampMicros"
:
66554433
,
"logicalLocalTimestampMillis"
:
11223344
,
"logicalLocalTimestampMicros"
:
5566778899
}