marc
marc

Reputation: 11

Kafka Streams group by aggregation has special characters in output

Im aggregating a list of objects in a KStream based on a object property and writing the aggregation to a output topic. However I'm getting special characters instead of '[',']' and ",", basically the array syntax.

This is my list serde -

private static final Serde<List<MyBean>> LIST__SERDE = new Serdes.ListSerde(ArrayList.class, new JsonSerde<>(MyBean.class).ignoreTypeHeaders());

My output string in Kafka message -

�{object1}�{object2} etc...

Upvotes: 0

Views: 186

Answers (1)

Felipe Tapia
Felipe Tapia

Reputation: 369

if you want to serialize a list of POJOs as a JSON list try with the following configuration.

final JsonSerde<MyBean[]> myBeanSerde;
        myBeanSerde = new JsonSerde<>(MyBean[].class).ignoreTypeHeaders().noTypeInfo();

Upvotes: 1

Related Questions