Field retention when passing avro record between microservices

If I have an avro record that I want to pass between different micro services over kafka, and let’s say I have 3 micro services Enricher, Reporter, Feedback and I pass a record Trade between them. Enricher sends the record to Reporter which sends to Feedback.

The language context is all Java.

If I introduce a new field “tradeDate” and I compile and deploy new version of the Enricher and Feedback but not the Reporter which sits in the middle.

Is there a way to retain “tradeDate” between all 3 micro services using the specific data type? Right now what is happening is I lose the “tradeDate” between the Enricher and the Reporter because the model compiled into “Reporter” doesn’t have it in the POJO so I can’t propogate it downstream.

I saw a way to do it by putting it all in a generic record but then I lose working with an actual object which is why I am looking for a way to keep the object somehow intact.

I tried using confluent’s KafkaAvroSerializer and Deserializer but then I lose the object.

  • No, it is impossible. As a side solution – you can pass forward generic record to the Feedback, while at the Reporter side you can read data to the own entity using ObjectMapper or any other json functionlity

    – 

  • This will allow you to pass any messages as-is to the needed destination but validation of received entity will be on your own

    – 

Leave a Comment