@RabbitListener — Concept Check
Questions on @RabbitListener. @RabbitListener binds a method to a queue and deserialises the message automatically; supports batching, reply-to, and customisable error handlers with MessageRecoverer.
Questions in this quiz
8 questions on @RabbitListener — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.A developer wants to consume messages from multiple queues using a single method. Which annotation setup allows this?
- A@RabbitListener(queue = "queue1, queue2")
- B@RabbitListener(queues = { "queue1", "queue2" })
- C@RabbitListener(queue = { "queue1", "queue2" })
- D@RabbitListener(queues = "queue1, queue2")
2.A method annotated with @RabbitListener processes messages but fails to acknowledge them. What could be the consequence?
- AMessages are lost without acknowledgment
- BMessages are automatically acknowledged on method return
- CMessages are sent to a dead-letter exchange immediately
- DMessages remain unacknowledged and may be requeued
3.A developer uses @RabbitListener with ackMode set to 'MANUAL'. What additional step must they take?
- AExplicitly call ack.acknowledge() after processing
- BConfigure a MessageConverter
- CUse @Header to extract AMQP headers
- DDeclare queues using @QueueBinding
4.How can a developer handle errors for a specific @RabbitListener method?
- ASet a custom ErrorHandler in the containerFactory
- BUse @QueueBinding to specify error handling
- CUse @ErrorHandler annotation on the method
- DConfigure error handling in application.properties
5.A service uses @RabbitListener with concurrency set to 1. What is a likely outcome during high load?
- AMessages are automatically batched
- BMessages are processed in parallel
- CMessage processing becomes a bottleneck
- DMessages are lost due to overflow
6.What does @RabbitListener automatically handle when binding a method to a queue?
- AManual acknowledgment of messages
- BCreation of a custom ErrorHandler
- CMessage deserialization via MessageConverter
- DConfiguration of DLX arguments
7.A developer notices that messages are not being processed from a queue. They are using @RabbitListener with inline queue declaration. What might be the issue?
- AThe queue or exchange might not exist
- BThe ackMode is set to AUTO
- CThe method is not annotated with @Header
- DThe MessageConverter is missing
8.What is the role of MessageRecoverer in @RabbitListener?
- AAutomatically retries message processing
- BHandles failed messages by dead-lettering or logging
- CManages the acknowledgment lifecycle
- DConverts messages to a different format