Complete the code to publish an event to a Kafka topic named 'orders'.
producer.send(new ProducerRecord<>("[1]", orderId, orderData));
The event must be sent to the 'orders' topic to notify other services about new orders.
Complete the code to consume events from the 'payments' topic.
consumer.subscribe(Collections.singletonList("[1]"));
Subscribing to the 'payments' topic allows the service to react to payment events.
Fix the error in the code that tries to orchestrate order processing by sending a command event.
producer.send(new ProducerRecord<>("[1]", orderId, command));
Commands should be sent to a dedicated 'order-commands' topic for orchestration.
Fill both blanks to create a dictionary comprehension that maps service names to their event topics only if the service is part of choreography.
service_topics = {service: [1] for service in services if service [2] choreography_services}The comprehension builds topic names by adding '-events' to service names that are in the choreography list.
Fill all three blanks to filter events with status 'completed' and map their IDs to payloads in a dictionary comprehension.
completed_events = {event[1]: event[2] for event in events if event[3] == "completed"}This comprehension creates a dictionary where keys are event IDs and values are payloads, filtering only events with status 'completed'.