0
0
Kafkadevops~10 mins

Exactly-once stream processing in Kafka - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable exactly-once processing in Kafka Streams.

Kafka
Properties props = new Properties();
props.put(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, [1]);
Drag options to blanks, or click blank then click option'
A"at_least_once"
B"at_most_once"
C"none"
D"exactly_once"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'at_least_once' which allows duplicates.
Using 'none' which disables guarantees.
2fill in blank
medium

Complete the code to commit Kafka Streams transactions for exactly-once processing.

Kafka
KafkaStreams streams = new KafkaStreams(builder.build(), props);
streams.[1]();
Drag options to blanks, or click blank then click option'
Aflush
Bstart
Cclose
Dcommit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'commit()' which is not a KafkaStreams method.
Using 'flush()' which only flushes records.
3fill in blank
hard

Fix the error in the code to enable exactly-once processing with idempotent producer.

Kafka
props.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, [1]);
Drag options to blanks, or click blank then click option'
A"true"
Bfalse
Ctrue
D"false"
Attempts:
3 left
💡 Hint
Common Mistakes
Using boolean true instead of string "true".
Using "false" which disables idempotence.
4fill in blank
hard

Fill both blanks to create a transactional producer with exactly-once semantics.

Kafka
props.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, [1]);
props.put(ProducerConfig.ACKS_CONFIG, [2]);
Drag options to blanks, or click blank then click option'
A"txn-id-1"
B"all"
C"1"
D"0"
Attempts:
3 left
💡 Hint
Common Mistakes
Using numeric values for transactional ID.
Setting acks to '1' or '0' which weakens guarantees.
5fill in blank
hard

Fill all three blanks to configure Kafka Streams for exactly-once processing with proper commit interval and retries.

Kafka
props.put(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, [1]);
props.put(StreamsConfig.COMMIT_INTERVAL_MS_CONFIG, [2]);
props.put(ProducerConfig.RETRIES_CONFIG, [3]);
Drag options to blanks, or click blank then click option'
A"exactly_once"
B1000
C5
D"at_least_once"
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'at_least_once' instead of 'exactly_once'.
Setting commit interval too high or retries too low.