Bird
0
0

Given this Spring Boot method listening to messages:

medium📝 component behavior Q13 of 15
Spring Boot - Messaging
Given this Spring Boot method listening to messages:
@JmsListener(destination = "orders")
public void receiveOrder(String order) {
    System.out.println("Received: " + order);
}

What will be printed if a message "Order123" is sent to the "orders" queue?
AReceived: Order123
Border
COrder123
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Understand the listener method

    The method prints "Received: " plus the message string it receives.
  2. Step 2: Apply the message content

    When "Order123" is sent, the output will be "Received: Order123".
  3. Final Answer:

    Received: Order123 -> Option A
  4. Quick Check:

    Output = "Received: " + message [OK]
Quick Trick: Listener prints prefix plus message content [OK]
Common Mistakes:
  • Expecting only the message without prefix
  • Thinking method prints variable name
  • Assuming no output without errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes