Kafka Adapter is unable to serialize a record when it contains both another record and an array of records

This is actually a reply to this other message Getting error in Kafka Adapter , to which I can’t reply because it is closed.

The same Exception reported there (ClassCastException: java.util.ArrayList cannot be cast to org.apache.avro.generic.IndexedRecord) happened to me, and at least in my case it happened when publishing to Confluent Kafka a message using an Avro schema that defined a record (structure) that in turn contained, as direct children, both another record and an array of records. I.e. an schema such as:

  • record1
    • array of record2
    • record3

This can be worked around if you change the Avro schema so that the array of record2 is not a direct child of record1, but it is wrapped inside another record; i.e.:

  • record1
    • record4
      • array of record2
    • record3

This must be a bug in Kafka Adapter. If I have time, I will file an SI in Empower.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.