0
0
Kafkadevops~10 mins

Join operations (KStream-KStream, KStream-KTable) 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 join two KStreams by key using an inner join.

Kafka
KStream<String, String> joinedStream = stream1.[1](stream2, (value1, value2) -> value1 + value2, JoinWindows.of(Duration.ofMinutes(5)), Joined.with(Serdes.String(), Serdes.String(), Serdes.String()));
Drag options to blanks, or click blank then click option'
Afilter
BleftJoin
Cjoin
DouterJoin
Attempts:
3 left
💡 Hint
Common Mistakes
Using leftJoin instead of join causes a different join behavior.
Using filter does not perform a join.
2fill in blank
medium

Complete the code to join a KStream with a KTable using a left join.

Kafka
KStream<String, String> joinedStream = stream.[1](table, (streamValue, tableValue) -> streamValue + (tableValue == null ? "" : tableValue));
Drag options to blanks, or click blank then click option'
Ajoin
Bfilter
CouterJoin
DleftJoin
Attempts:
3 left
💡 Hint
Common Mistakes
Using join instead of leftJoin excludes stream records without matching table keys.
Using outerJoin is not supported between KStream and KTable.
3fill in blank
hard

Fix the error in the join window definition for a KStream-KStream join.

Kafka
KStream<String, String> joinedStream = stream1.join(stream2, (v1, v2) -> v1 + v2, JoinWindows.[1](Duration.ofMinutes(10)), Joined.with(Serdes.String(), Serdes.String(), Serdes.String()));
Drag options to blanks, or click blank then click option'
Aof
BofTimeDifferenceWithNoGrace
CwithTimeDifferenceAndGrace
DofMillis
Attempts:
3 left
💡 Hint
Common Mistakes
Using deprecated or incorrect window methods causes runtime errors.
Using ofMillis expects a long, not a Duration.
4fill in blank
hard

Fill both blanks to create a KStream-KTable join with correct Serdes and join type.

Kafka
KStream<String, String> result = stream.[1](table, (sValue, tValue) -> sValue + tValue, Joined.with(Serdes.[2], Serdes.String(), Serdes.String()));
Drag options to blanks, or click blank then click option'
AleftJoin
Bjoin
CString
DInteger
Attempts:
3 left
💡 Hint
Common Mistakes
Using join instead of leftJoin excludes stream records without matching keys.
Using Integer serde for string keys causes serialization errors.
5fill in blank
hard

Fill all three blanks to create a KStream-KStream join with a 5-minute window and correct join type and serde.

Kafka
KStream<String, String> joined = stream1.[1](stream2, (v1, v2) -> v1 + v2, JoinWindows.[2](Duration.ofMinutes(5)), Joined.with(Serdes.[3], Serdes.String(), Serdes.String()));
Drag options to blanks, or click blank then click option'
Ajoin
BleftJoin
Cof
DString
Attempts:
3 left
💡 Hint
Common Mistakes
Using leftJoin instead of join changes join semantics.
Using incorrect window method causes errors.
Using wrong serde causes serialization issues.