@KafkaListener — Concept Check
Questions on @KafkaListener. @KafkaListener annotates a method to consume records from one or more topics; supports batch consumption, error handlers, and retry with @RetryableTopic for DLT routing.
Questions in this quiz
8 questions on @KafkaListener — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer wants to process records from multiple topics using a single @KafkaListener method. Which configuration allows this?
- AUse the 'topics' parameter with a list of topic names
- BUse 'topicPattern' with a regex matching all topics
- CConfigure multiple @KafkaListener annotations for each topic
- DSet 'concurrency' to the number of topics
2.A service using @KafkaListener slows down significantly. Logs show frequent retries and eventual routing to a DLT. What might be happening?
- AThe Kafka broker is down, causing retries and DLT routing
- BThe service is processing messages too quickly
- CThe @KafkaListener is not configured to handle errors
- DThe service is encountering transient errors that trigger retries
3.How does @RetryableTopic handle retries differently than a manual retry loop?
- AIt requires manual configuration of retry intervals
- BIt only retries once before routing to DLT
- CIt does not support exponential back-off
- DIt automatically creates retry topics and handles back-off
4.A developer sets 'concurrency' to '5' in @KafkaListener, but only sees 3 threads running. What could be the reason?
- AConcurrency is limited by the number of CPU cores
- BThe Kafka broker limits concurrency
- CThe group ID is not unique
- DThe topic has only 3 partitions
5.When using batch mode in @KafkaListener, what is a key advantage?
- AIt requires less configuration than single-record mode
- BBatch mode automatically retries failed records
- CEach record is processed in a separate transaction
- DProcessing multiple records per poll reduces overhead
6.What happens if a @KafkaListener method throws a TransientDataException and @RetryableTopic is configured?
- AThe message is retried according to the back-off settings
- BThe exception is ignored and processing continues
- CThe message is immediately sent to the DLT
- DThe listener stops processing further messages
7.A developer uses @KafkaListener with 'manual' ack mode but notices messages are not acknowledged. What might be the issue?
- AThe acknowledgment object is not being used in the method
- BThe group ID is not specified
- CThe method lacks a return statement
- DThe 'topics' parameter is missing
8.What is the purpose of the 'dltTopicSuffix' parameter in @RetryableTopic?
- ATo define the delay before routing to DLT
- BTo set the number of retries before DLT routing
- CTo specify the suffix for the Dead Letter Topic
- DTo configure the retry interval for transient errors