CCDAK · Question #129
What is an adequate topic configuration for the topic word-count-output? StreamsBuilder builder = new StreamsBuilder(); KStream<String, String> textLines = builder.stream("word-count-input")…
The correct answer is D. cleanup.policy=compact. Result is aggregated into a table with key as the unique word and value its frequency. We have to enable log compaction for this topic to align the topic's cleanup policy with KTable semantics.
Question
What is an adequate topic configuration for the topic word-count-output? StreamsBuilder builder = new StreamsBuilder(); KStream<String, String> textLines = builder.stream("word-count-input"); KTable<String, Long> wordCounts = textLines .mapValues(textLine -> textLine.toLowerCase()) .flatMapValues(textLine -> Arrays.asList(textLine.split("\W+"))) .selectKey((key, word) -> word) .groupByKey() .count(Materialized.as("Counts")); wordCounts.toStream().to("word-count-output", Produced.with(Serdes.String(), Serdes.Long())); builder.build();
Options
- Amax.message.bytes=10000000
- Bcleanup.policy=delete
- Ccompression.type=lz4
- Dcleanup.policy=compact
How the community answered
(29 responses)- A3% (1)
- B10% (3)
- C17% (5)
- D69% (20)
Explanation
Result is aggregated into a table with key as the unique word and value its frequency. We have to enable log compaction for this topic to align the topic's cleanup policy with KTable semantics.
Topics
Community Discussion
No community discussion yet for this question.