Hello, I am trying something like the word count example and trying to get the value as Long for output. Either to a console or for another consumer application. However, there seems to be an issue with the Long serialization. Basically any version of the word count example I found on GitHub does not seem to work with my current version of Kafka streams / client 3.2.
E.g. this official one from Confluent on Github. The output will only be the key, not the value.
//this below works fine, when using a String to output the number
ktableoutput.toStream().mapValues(v -> v.toString() + " additional information").to("testoutput", Produced.with(Serdes.String(), Serdes.String()));
//ideally, this should output the Long Number directly, however DOES NOT WORK
ktableoutput.toStream().to("testoutput", Produced.with(Serdes.String(), Serdes.Long()));
I did try numerous variations (e.g. using Integer) but to no avail.
Using the following relevant config below (also tried it with getName() or without put. )
I am also facing the same issue with Kafka v3.0.4.
In a same scenario, when I check the value in Kafka UI (Conduktor UI), I could see the value as ‘Null Null Null Null’ for my key.
So, it is a sequence of Null characters. Ideally it should be a Long value.
Given that the output is “\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001” it seems to be indeed 8 bytes and thus a long though.
I would assume that Conduktor assume the incorrect type? I am not familiar with Conduktor, so not sure how you can tell it that it’s a long? In the end, Kafka itself does not store any data type, and thus, it’s not possible to infer it – the client reading the data must know the data type.