You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/08/14 11:41:00 UTC

[servicecomb-pack] 04/21: SCB-1418 change FsmAutoConfiguration.kafkaEventChannel

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git

commit 33b2bf9adbe78596f79e0124e6e35b1fa722ac59
Author: CMonkey <42...@gmail.com>
AuthorDate: Tue Aug 13 11:46:42 2019 +0800

    SCB-1418 change FsmAutoConfiguration.kafkaEventChannel
---
 .../apache/servicecomb/pack/alpha/fsm/FsmAutoConfiguration.java   | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/alpha/alpha-fsm/src/main/java/org/apache/servicecomb/pack/alpha/fsm/FsmAutoConfiguration.java b/alpha/alpha-fsm/src/main/java/org/apache/servicecomb/pack/alpha/fsm/FsmAutoConfiguration.java
index c26b82c..17ece87 100644
--- a/alpha/alpha-fsm/src/main/java/org/apache/servicecomb/pack/alpha/fsm/FsmAutoConfiguration.java
+++ b/alpha/alpha-fsm/src/main/java/org/apache/servicecomb/pack/alpha/fsm/FsmAutoConfiguration.java
@@ -26,6 +26,7 @@ import com.typesafe.config.ConfigFactory;
 import java.util.Map;
 import javax.annotation.PostConstruct;
 import org.apache.servicecomb.pack.alpha.fsm.channel.ActiveMQActorEventChannel;
+import org.apache.servicecomb.pack.alpha.fsm.channel.kafka.KafkaMessagePublisher;
 import org.apache.servicecomb.pack.alpha.fsm.channel.redis.RedisMessagePublisher;
 import org.apache.servicecomb.pack.alpha.fsm.metrics.MetricsService;
 import org.apache.servicecomb.pack.alpha.fsm.repository.NoneTransactionRepository;
@@ -102,6 +103,7 @@ public class FsmAutoConfiguration {
   }
 
   @Bean
+  @ConditionalOnProperty(value = "alpha.feature.akka.channel.type", havingValue = "memory")
   @ConditionalOnMissingBean(ActorEventChannel.class)
   public ActorEventChannel memoryEventChannel(ActorEventSink actorEventSink,
       MetricsService metricsService) {
@@ -111,6 +113,7 @@ public class FsmAutoConfiguration {
 
   @Bean
   @ConditionalOnProperty(value = "alpha.feature.akka.channel.type", havingValue = "activemq")
+  @ConditionalOnMissingBean(ActorEventChannel.class)
   public ActorEventChannel activeMqEventChannel(ActorEventSink actorEventSink,
       MetricsService metricsService) {
     return new ActiveMQActorEventChannel(actorEventSink, metricsService);
@@ -118,9 +121,10 @@ public class FsmAutoConfiguration {
 
   @Bean
   @ConditionalOnProperty(value = "alpha.feature.akka.channel.type", havingValue = "kafka")
+  @ConditionalOnMissingBean(ActorEventChannel.class)
   public ActorEventChannel kafkaEventChannel(ActorEventSink actorEventSink,
-      MetricsService metricsService) {
-    return new KafkaActorEventChannel(actorEventSink, metricsService);
+      MetricsService metricsService, @Lazy KafkaMessagePublisher kafkaMessagePublisher){
+    return new KafkaActorEventChannel(actorEventSink, metricsService, kafkaMessagePublisher);
   }
 
   @Bean