Bird
0
0

Identify the error in this code snippet:

medium📝 Debug Q14 of 15
Spring Boot - Messaging
Identify the error in this code snippet:
rabbitTemplate.convertAndSend("myExchange", message);
AMissing routing key parameter
BMessage must be a JSON object
CExchange name cannot be a string
DconvertAndSend cannot send strings
Step-by-Step Solution
Solution:
  1. Step 1: Check method signature

    The method convertAndSend requires exchange, routing key, and message parameters.
  2. Step 2: Identify missing argument

    The routing key is missing in the call, causing a syntax or runtime error.
  3. Final Answer:

    Missing routing key parameter -> Option A
  4. Quick Check:

    convertAndSend needs exchange, routing key, message [OK]
Quick Trick: convertAndSend needs 3 parameters: exchange, routing key, message [OK]
Common Mistakes:
  • Omitting routing key parameter
  • Assuming message must be JSON
  • Thinking exchange cannot be string

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Spring Boot Quizzes