Spring Boot - MessagingWhich of the following is the correct way to configure a Kafka topic name in a @KafkaListener annotation?A@KafkaListener(topic = "orders")B@KafkaListener(topics = orders)C@KafkaListener(topics = "orders")D@KafkaListener(topic = orders)Check Answer
Step-by-Step SolutionSolution:Step 1: Check correct attribute nameThe attribute to specify topics is 'topics' (plural), not 'topic'.Step 2: Confirm string usageTopic names must be strings, so they require quotes around the name.Final Answer:@KafkaListener(topics = "orders") -> Option CQuick Check:Correct topic attribute and string = @KafkaListener(topics = "orders") [OK]Quick Trick: Use 'topics' with quotes for topic names in @KafkaListener [OK]Common Mistakes:Using 'topic' instead of 'topics'Omitting quotes around topic namePassing variable without quotes
Master "Messaging" in Spring Boot9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallPerf
More Spring Boot Quizzes Advanced Patterns - Circuit breaker with Resilience4j - Quiz 15hard Advanced Patterns - Conditional bean creation - Quiz 9hard Advanced Patterns - Why enterprise patterns matter - Quiz 3easy Aspect-Oriented Programming - Why AOP matters - Quiz 9hard Async Processing - Exception handling in async - Quiz 15hard Async Processing - Cron expressions for scheduling - Quiz 10hard Caching - Why caching matters for performance - Quiz 14medium Spring Boot Actuator - Securing actuator endpoints - Quiz 11easy Testing Spring Boot Applications - TestRestTemplate for full integration - Quiz 4medium Testing Spring Boot Applications - @WebMvcTest for controller testing - Quiz 6medium