WillemJiang commented on a change in pull request #691:
URL: https://github.com/apache/servicecomb-pack/pull/691#discussion_r567390731



##########
File path: 
alpha/alpha-fsm/src/main/java/org/apache/servicecomb/pack/alpha/fsm/channel/rabbit/RabbitChannelAutoConfiguration.java
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.pack.alpha.fsm.channel.rabbit;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import org.apache.servicecomb.pack.alpha.core.fsm.channel.ActorEventChannel;
+import org.apache.servicecomb.pack.alpha.fsm.metrics.MetricsService;
+import org.springframework.beans.factory.annotation.Qualifier;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.cloud.stream.config.BindingProperties;
+import org.springframework.cloud.stream.config.BindingServiceProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+import java.util.Map;
+
+@EnableBinding({RabbitMessageChannel.class})
+@Configuration
+@EnableConfigurationProperties(BindingServiceProperties.class)
+@ConditionalOnProperty(value = "alpha.feature.akka.channel.type", havingValue 
= "rabbit")
+public class RabbitChannelAutoConfiguration {
+
+
+    @Bean
+    @ConditionalOnMissingBean()
+    public RabbitMessagePublisher 
rabbitMessagePublisher(BindingServiceProperties bindingServiceProperties, 
RabbitMessageChannel producerMessage) {
+        Map<String, BindingProperties> bindings = 
bindingServiceProperties.getBindings();
+        // 分区数量,现在现在生产者与消费这都在alpha-server,所以rabbit的分区partitionCount与该数量保持一直

Review comment:
       Please add English comments.

##########
File path: alpha/alpha-server/src/main/resources/application.yaml
##########
@@ -146,6 +146,46 @@ spring:
       eclipselink:
         ddl-generation: none
 
+---
+spring:
+  profiles: rabbit
+  cloud:
+    stream:
+      binders:
+        defaultRabbit:
+          type: rabbit
+          environment:
+            spring:
+              rabbitmq:
+                host: 127.0.0.1

Review comment:
       It's better to provide the default setting as docker compose does.

##########
File path: 
alpha/alpha-fsm/src/main/java/org/apache/servicecomb/pack/alpha/fsm/channel/rabbit/RabbitChannelAutoConfiguration.java
##########
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.servicecomb.pack.alpha.fsm.channel.rabbit;
+
+import akka.actor.ActorRef;
+import akka.actor.ActorSystem;
+import org.apache.servicecomb.pack.alpha.core.fsm.channel.ActorEventChannel;
+import org.apache.servicecomb.pack.alpha.fsm.metrics.MetricsService;
+import org.springframework.beans.factory.annotation.Qualifier;
+import 
org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import 
org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.cloud.stream.annotation.EnableBinding;
+import org.springframework.cloud.stream.config.BindingProperties;
+import org.springframework.cloud.stream.config.BindingServiceProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+
+import java.util.Map;
+
+@EnableBinding({RabbitMessageChannel.class})
+@Configuration
+@EnableConfigurationProperties(BindingServiceProperties.class)
+@ConditionalOnProperty(value = "alpha.feature.akka.channel.type", havingValue 
= "rabbit")
+public class RabbitChannelAutoConfiguration {
+
+
+    @Bean
+    @ConditionalOnMissingBean()
+    public RabbitMessagePublisher 
rabbitMessagePublisher(BindingServiceProperties bindingServiceProperties, 
RabbitMessageChannel producerMessage) {
+        Map<String, BindingProperties> bindings = 
bindingServiceProperties.getBindings();
+        // 分区数量,现在现在生产者与消费这都在alpha-server,所以rabbit的分区partitionCount与该数量保持一直
+        int partitionCount = 
bindings.get(RabbitMessageChannel.SERVICE_COMB_PACK_PRODUCER).getProducer().getPartitionCount();
+        RabbitMessagePublisher messagePublisher = new 
RabbitMessagePublisher(partitionCount, producerMessage);
+        return messagePublisher;
+    }
+
+//    @StreamMessageConverter

Review comment:
       Please remove the commented code.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to