0
0
Kafkadevops~30 mins

Why delivery guarantees affect correctness in Kafka - See It in Action

Choose your learning style9 modes available
Why Delivery Guarantees Affect Correctness in Kafka
📖 Scenario: You are building a simple message processing system using Kafka. Messages represent orders that must be processed exactly once to avoid errors like double billing or lost orders.
🎯 Goal: Learn how different Kafka delivery guarantees (at-most-once, at-least-once, exactly-once) affect the correctness of message processing.
📋 What You'll Learn
Create a Kafka producer with a list of order messages
Set a delivery guarantee configuration variable
Simulate message sending with the chosen delivery guarantee
Print the final processed orders to observe correctness
💡 Why This Matters
🌍 Real World
Kafka is used in real systems to send messages like orders, logs, or events. Delivery guarantees help ensure these messages are processed correctly without loss or duplication.
💼 Career
Understanding delivery guarantees is important for software engineers working with distributed systems, data pipelines, and event-driven architectures to build reliable applications.
Progress0 / 4 steps
1
Create a list of order messages
Create a list called orders with these exact string values: 'order1', 'order2', 'order3'
Kafka
Need a hint?

Use square brackets to create a list and separate items with commas.

2
Set the delivery guarantee configuration
Create a variable called delivery_guarantee and set it to the string 'at-least-once'
Kafka
Need a hint?

Assign the string 'at-least-once' to the variable delivery_guarantee.

3
Simulate sending orders with delivery guarantee
Create an empty list called processed_orders. Use a for loop with variable order to iterate over orders. Inside the loop, append order to processed_orders. If delivery_guarantee is 'at-least-once', append order a second time to simulate possible duplicates.
Kafka
Need a hint?

Use a for loop to add each order to processed_orders. Add it twice if delivery_guarantee is 'at-least-once'.

4
Print the processed orders
Write a print statement to display the processed_orders list.
Kafka
Need a hint?

Use print(processed_orders) to show the list.