Kafka organizes messages into topics. What is the main reason for this design?
Think about how consumers get messages they want.
Topics group related messages so consumers can subscribe to only the data they need, making message handling efficient and organized.
Given a Kafka topic named 'orders' with messages: 'order1', 'order2', 'order3', what will a consumer receive when subscribed to this topic?
Think about how Kafka delivers messages from a topic.
Consumers subscribed to a topic receive all messages in the order they were produced, ensuring no message is missed.
Consider this Kafka consumer code snippet that subscribes to a topic but misses some messages:
consumer.subscribe(['sales']) consumer.poll(0) consumer.close()
What is the likely reason?
Think about how polling works in Kafka consumers.
Polling with zero timeout returns immediately without waiting for messages. Closing the consumer right after means no messages are processed.
Which option contains a syntax error in subscribing a Kafka consumer to a topic?
consumer.subscribe('payments')Check the expected argument type for subscribe method.
The subscribe method expects a list of topics, not a single string. Passing a string causes an error.
Kafka topics are divided into partitions. How does this help scale message processing?
Think about how dividing work helps many workers process faster.
Partitions split a topic into parts so multiple consumers can read different partitions at the same time, making processing faster and scalable.