Svetlana
Svetlana

Reputation: 85

Is it possible to pass generic class message to Kafka?

I have a Spring Boot application, which sends Kafka messages.
For different scenarios, different Kafka message classes are now used, but they all have the same structure, as they simply represent a wrapper of an object.

remark:
Let's say I have classes Pet, Cat, Dog, CatKafkaDto and DogKafkaDto.
Both Cat and Dog extend Pet class.
CatKafkaDto has only one field -- Cat, DogKafkaDto also has the only field -- Dog.

Is it possible to send and receive a Kafka message like AbstractKafkaDto<T extends Pet> with Python and Java?
Or it is better to have a separate type of Kafka message for every Pet subclass?

Upvotes: 0

Views: 35

Answers (0)

Related Questions