refactor: Removed config-dependencies from `ChannelTaskExecutor`
authorKai Moritz <kai@juplo.de>
Wed, 6 Mar 2024 09:23:53 +0000 (10:23 +0100)
committerKai Moritz <kai@juplo.de>
Thu, 14 Mar 2024 08:11:21 +0000 (09:11 +0100)
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/ChannelTaskExecutor.java
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesConfiguration.java

index 636c03b..4520677 100644 (file)
@@ -1,7 +1,6 @@
 package de.juplo.kafka.chat.backend.implementation.kafka;
 
 import de.juplo.kafka.chat.backend.implementation.kafka.messages.AbstractMessageTo;
-import jakarta.annotation.PreDestroy;
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -37,7 +36,6 @@ public class ChannelTaskExecutor
         });
   }
 
-  @PreDestroy
   public void join()
   {
     log.info("Signaling the consumer-task for {} to quit its work", channel);
index 54aa41f..b28b690 100644 (file)
@@ -54,7 +54,7 @@ public class KafkaServicesConfiguration
         dataChannelTaskExecutor);
   }
 
-  @Bean
+  @Bean(destroyMethod = "join")
   ChannelTaskExecutor infoChannelTaskExecutor(
       ThreadPoolTaskExecutor taskExecutor,
       InfoChannel infoChannel,
@@ -84,7 +84,7 @@ public class KafkaServicesConfiguration
     };
   }
 
-  @Bean
+  @Bean(destroyMethod = "join")
   ChannelTaskExecutor dataChannelTaskExecutor(
       ThreadPoolTaskExecutor taskExecutor,
       DataChannel dataChannel,