Bird
0
0

Which annotation is used to mark a method as a RabbitMQ message listener in Spring Boot?

easy📝 Syntax Q3 of 15
Spring Boot - Messaging
Which annotation is used to mark a method as a RabbitMQ message listener in Spring Boot?
A@RabbitListener
B@MessageListener
C@RabbitHandler
D@QueueListener
Step-by-Step Solution
Solution:
  1. Step 1: Recall the correct listener annotation

    Spring Boot uses @RabbitListener to mark methods that listen to RabbitMQ queues.
  2. Step 2: Differentiate from similar annotations

    @RabbitHandler is used for method overloading inside a listener class, not for marking the listener itself. Other options are invalid.
  3. Final Answer:

    @RabbitListener -> Option A
  4. Quick Check:

    Listener annotation = @RabbitListener [OK]
Quick Trick: Use @RabbitListener to receive messages [OK]
Common Mistakes:
  • Confusing @RabbitHandler with @RabbitListener
  • Using non-existent annotations like @QueueListener
  • Assuming @MessageListener is correct

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes