Hi,
I am new to KAFKA.
Following piece of code throws exception at runtime at highlighted line.
final KStream<String, String> textLines = builder.stream(stringSerde, stringSerde, "TextLinesTopic");
final KStream<String, String> textLines1 = textLines.selectKey((key, value) -> value.split(";")[1]);
final KStream<String, Long> textLines2 = textLines1.mapValues(value -> Long.valueOf(value.split(";")[3]));
textLines2.groupByKey().reduce((v1, v2) -> v1 + v2, "sum");
Following is the exception
Exception in thread "StreamThread-1" java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
at org.apache.kafka.common.serialization.StringSerializer.serialize(StringSerializer.java:24)
at org.apache.kafka.streams.processor.internals.RecordCollectorImpl.send(RecordCollectorImpl.java:64)
Record in TextLinesTopic is like :
2016-08-02 10:00:08.754;23230372950;-2;205;1200;672;
Thanks,
Mangesh Sawant.