AvroPayloadSerializer

Thin Kotlin wrapper around Confluent's KafkaAvroSerializer configured with the Schema Registry URL taken from KafkaInfraProperties.

Serializes any Avro SpecificRecord / GenericRecord value to the Confluent wire format ([magic byte][schema-id][avro payload]) so that the resulting ByteArray can be handed to the standard ByteArraySerializer-based KafkaTemplate used by the outbox processor. Paired with AvroPayloadDeserializer on the consumer side.

Constructors

Link copied to clipboard
constructor(properties: KafkaInfraProperties)

Functions

Link copied to clipboard
fun serialize(topic: String, value: Any): ByteArray

Serializes value for the given topic and returns the Confluent Avro wire-format bytes (registers the schema in Schema Registry on first use). value must be an Avro SpecificRecord or GenericRecord.