Specifying a custom Avro serializer

You can specify a custom Avro serializer in place of the Confluent Kafka Avro Serializer that is used by default with all Avro-compatible integrated Kafka custom operation processors (KCOPs).

About this task

A custom Avro serializer class must be specified in a classpath. You might want to specify a custom classpath for KCOPs to provide all required external dependencies.

Procedure

Add the serializer.class property to a KCOP configuration file. The value should be equal to the fully qualified name of a class that implements the org.apache.kafka.common.serialization.Serializer interface.

If you want to specify properties that should be passed to a custom Avro serializer, use the serializer.property prefix. The following example makes all Avro-compatible integrated KCOPs use the com.ibm.serializer.AvroSerializer class as an Avro serializer, and passes the serializerproperty1 and serializerproperty2 properties when configuring the class:

serializer.class=com.ibm.serializer.AvroSerializer
serializer.property.serializerproperty1=value1
serializer.property.serializerproperty2=value2