Hello.
We are currently implementing Flowable Event Registry with Kafka as a channel type. Currently we are using Avro in our system and we are searching a way to implement custom EventPayload Avro serializer/deserializer.
Can you give us some hint or guidance on how to achieve that?
You can customize serializers/deserializers by defining the serializer/deserializer type in the channel definition file as “expression”. For instance a inbound channel definition file would look something like:
{
"type": "kafka",
"channelType": "inbound",
"deserializerType": "expression",
"deserializerDelegateExpression" : "${myCustomDeserializer}",
...
}
where ${myCustomDeserializer} is a Spring bean named myCustomDeserializer and is implemented like
public class MyCustomDeserializer implements InboundEventDeserializer<T> {
@Override
public T deserialize(String rawEvent) {
....
}
T is the type the deserializer produces from parsing the rawEvent. The default deserializer in Flowable produces types of JsonNode. If the deserializer produces a type other than JsonNode, then you will need to implement InboundEventPayloadExtractor as well and install those in your channel definition file as:
"payloadExtractorDelegateExpression":"${myPayloadExtractor}"
1 Like
Thank you for the information. We will certainly try it and see if it suits our needs.