0
0
Kafkadevops~10 mins

Event choreography vs orchestration in Kafka - Interactive Practice

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

Complete the code to publish an event to a Kafka topic named 'orders'.

Kafka
producer.send(new ProducerRecord<>("[1]", orderId, orderData));
Drag options to blanks, or click blank then click option'
Aorders
Bpayments
Cshipments
Dinventory
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong topic name causes events to be sent to unrelated services.
Misspelling the topic name leads to runtime errors.
2fill in blank
medium

Complete the code to consume events from the 'payments' topic.

Kafka
consumer.subscribe(Collections.singletonList("[1]"));
Drag options to blanks, or click blank then click option'
Apayments
Borders
Cshipments
Dinventory
Attempts:
3 left
💡 Hint
Common Mistakes
Subscribing to the wrong topic means missing important events.
Using an empty or null topic list causes errors.
3fill in blank
hard

Fix the error in the code that tries to orchestrate order processing by sending a command event.

Kafka
producer.send(new ProducerRecord<>("[1]", orderId, command));
Drag options to blanks, or click blank then click option'
Aorder-updates
Border-events
Corder-choreography
Dorder-commands
Attempts:
3 left
💡 Hint
Common Mistakes
Sending commands to event topics mixes orchestration with choreography.
Using a generic topic name causes confusion in message handling.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps service names to their event topics only if the service is part of choreography.

Kafka
service_topics = {service: [1] for service in services if service [2] choreography_services}
Drag options to blanks, or click blank then click option'
Aservice + "-events"
Bservice == "payment"
Cin
Dservice != "inventory"
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' instead of 'in' for membership tests.
Not concatenating the '-events' suffix correctly.
5fill in blank
hard

Fill all three blanks to filter events with status 'completed' and map their IDs to payloads in a dictionary comprehension.

Kafka
completed_events = {event[1]: event[2] for event in events if event[3] == "completed"}
Drag options to blanks, or click blank then click option'
A.id
B.payload
C.status
D.type
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong property names like '.type' instead of '.status'.
Mixing keys and values in the comprehension.