8383import org .springframework .retry .annotation .Backoff ;
8484import org .springframework .scheduling .TaskScheduler ;
8585import org .springframework .scheduling .concurrent .ThreadPoolTaskScheduler ;
86- import org .springframework .stereotype .Component ;
8786import org .springframework .test .annotation .DirtiesContext ;
8887import org .springframework .test .context .TestPropertySource ;
8988import org .springframework .test .context .junit .jupiter .SpringJUnitConfig ;
9493 *
9594 * @author Wang Zhiyang
9695 * @author Artem Bilan
96+ * @author Sanghyeok An
9797 *
9898 * @since 3.2
9999 */
@@ -304,7 +304,6 @@ private boolean awaitLatch(CountDownLatch latch) {
304304 }
305305 }
306306
307- @ Component
308307 @ KafkaListener (id = "firstTopicId" , topics = FIRST_TOPIC , containerFactory = MAIN_TOPIC_CONTAINER_FACTORY ,
309308 errorHandler = "myCustomErrorHandler" , contentTypeConverter = "myCustomMessageConverter" ,
310309 concurrency = "2" )
@@ -324,7 +323,6 @@ public void listen(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String r
324323
325324 }
326325
327- @ Component
328326 @ KafkaListener (topics = SECOND_TOPIC , containerFactory = MAIN_TOPIC_CONTAINER_FACTORY )
329327 static class SecondTopicListener {
330328
@@ -338,7 +336,6 @@ public void listenAgain(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) Str
338336 }
339337 }
340338
341- @ Component
342339 @ RetryableTopic (attempts = "${five.attempts}" ,
343340 backoff = @ Backoff (delay = 250 , maxDelay = 1000 , multiplier = 1.5 ),
344341 numPartitions = "#{3}" ,
@@ -365,7 +362,6 @@ public void annotatedDltMethod(Object message) {
365362 }
366363 }
367364
368- @ Component
369365 @ RetryableTopic (dltStrategy = DltStrategy .NO_DLT , attempts = "4" , backoff = @ Backoff (300 ),
370366 sameIntervalTopicReuseStrategy = SameIntervalTopicReuseStrategy .MULTIPLE_TOPICS ,
371367 kafkaTemplate = "${kafka.template}" )
@@ -444,7 +440,6 @@ public void listenWithAnnotation2(String message, @Header(KafkaHeaders.RECEIVED_
444440
445441 }
446442
447- @ Component
448443 @ RetryableTopic (attempts = "4" , backoff = @ Backoff (50 ),
449444 sameIntervalTopicReuseStrategy = SameIntervalTopicReuseStrategy .MULTIPLE_TOPICS )
450445 @ KafkaListener (id = "manual" , topics = MANUAL_TOPIC , containerFactory = MAIN_TOPIC_CONTAINER_FACTORY )
@@ -463,7 +458,6 @@ public void listenNoDlt(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) Str
463458
464459 }
465460
466- @ Component
467461 @ RetryableTopic (attempts = "3" , numPartitions = "3" , exclude = MyDontRetryException .class ,
468462 backoff = @ Backoff (delay = 50 , maxDelay = 100 , multiplier = 3 ),
469463 traversingCauses = "true" , kafkaTemplate = "${kafka.template}" )
@@ -485,7 +479,6 @@ public void annotatedDltMethod(Object message) {
485479 }
486480 }
487481
488- @ Component
489482 @ RetryableTopic (attempts = "2" , backoff = @ Backoff (50 ))
490483 @ KafkaListener (id = "reuseRetry1" , topics = FIRST_REUSE_RETRY_TOPIC ,
491484 containerFactory = "retryTopicListenerContainerFactory" )
@@ -505,7 +498,6 @@ public void listen1(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String
505498
506499 }
507500
508- @ Component
509501 @ RetryableTopic (attempts = "5" , backoff = @ Backoff (delay = 30 , maxDelay = 100 , multiplier = 2 ))
510502 @ KafkaListener (id = "reuseRetry2" , topics = SECOND_REUSE_RETRY_TOPIC ,
511503 containerFactory = "retryTopicListenerContainerFactory" )
@@ -525,7 +517,6 @@ public void listen2(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String
525517
526518 }
527519
528- @ Component
529520 @ RetryableTopic (attempts = "5" , backoff = @ Backoff (delay = 1 , maxDelay = 5 , multiplier = 1.4 ))
530521 @ KafkaListener (id = "reuseRetry3" , topics = THIRD_REUSE_RETRY_TOPIC ,
531522 containerFactory = "retryTopicListenerContainerFactory" )
@@ -545,7 +536,6 @@ public void listen3(String message, @Header(KafkaHeaders.RECEIVED_TOPIC) String
545536
546537 }
547538
548- @ Component
549539 static class CountDownLatchContainer {
550540
551541 CountDownLatch countDownLatch1 = new CountDownLatch (5 );
@@ -594,7 +584,6 @@ private void countDownIfNotKnown(String receivedTopic, CountDownLatch countDownL
594584 }
595585 }
596586
597- @ Component
598587 static class MyCustomDltProcessor {
599588
600589 @ Autowired
0 commit comments