Deserializers
Joule ships with the ability to parse domain types using a custom deserialiser along with standard StreamEvent deserialisers
Deserialization Specification
The DeserializerSpecification
class is used to defined how StreamEvents are serialised for downstream consumption.
Attributes
Attribute | Description | Type |
---|---|---|
parser | Parser interface to convert a Object to a collection of stream events | StreamEventParser Default: StreamEventJsonDeserializer |
compressed | If passed payload is compressed | Boolean Default: false |
batch | Is payload a batch os events | Boolean Default: false |
properties | Specific properties required for custom deserialization process | Properties |
StreamEventParser
Parser interface to converts an Object to a collection of stream events.Developers are expected to provide domain specific implementations if there is a need to publish non-Joule events.
Available Implementations
Format | DSL | Class |
---|---|---|
json | json deserializer | StreamEventJsonDeserializer |
csv | csv deserializer | StreamEventCSVDeserializer |
object | object deserializer | StreamEventObjectDeserializer |
avro | avro deserializer | AvroDomainDeserializer |
Example
For the provided implementations a full package namespace is required. For the above implementations use com.fractalworks.streams.sdk.codec
AVRO
This deserializer has extra setting to support ability to load the target schema. Currently only local schema files are supported with schema registry support on request.
Attribute | Description | Type | Required |
---|---|---|---|
schema | Path and name of schema file | String | |
field mapping | Map source feilds to map to a target StreamEvent field | Map<String,String> |
Example
CSV
This parser has extra optional setting to support ability to custom parsing through the use of defining a custom header.
Attribute | Description | Type | Required |
---|---|---|---|
type map | Map of fields to types. See supported types | Map<String,Type> | |
delimiter | Define a custom file delimiter | String Default: "," | |
date format | Provide a custom date format. | String Default: yyyy/MM/dd |
Example
Supported Types
Following types are supported
DOUBLE, FLOAT, LONG, INTEGER, SHORT, BYTE, BOOLEAN, STRING, DATE
Custom Example
Last updated