Why can't I see any way out of the Kafka thread reduction method?

Given the following code:

KStream<String, Custom> stream =  
    builder.stream(Serdes.String(), customSerde, "test_in");

stream
    .groupByKey(Serdes.String(), customSerde)
    .reduce(new CustomReducer(), "reduction_state")
    .print(Serdes.String(), customSerde);

I have a statement printlninside the apply method for Reducer that prints successfully when I expect this to happen. However, the last print statement shown above does not display anything. similarly, if I use the method to, but not print, I do not see the messages in the destination subject.

What do I need after the reduction instruction to see the result of the reduction? If a single value is input, I do not expect to see anything. If a second value with the same key is pressed, I expect the reducer to apply (what it does), and I also expect the restore result to continue the next step in the processing pipeline. As described, I do not see anything in the subsequent steps of the pipeline, and I do not understand why.

+4
source share
1 answer

Kafka 0.10.1.0, , KTable. , , <key:1>, <key:2>.

<key:1> , . <key:2> , . , , . , ( ). , KTable <key:2> ( <key:1> ).

Streams StreamConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG. , , KTable ( pre 0.10.1.0).

, :

+7

Source: https://habr.com/ru/post/1660443/


All Articles