You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/11/11 05:25:25 UTC

[GitHub] [dubbo-go-pixiu] AlexStocks commented on a change in pull request #299: add filter logic

AlexStocks commented on a change in pull request #299:
URL: https://github.com/apache/dubbo-go-pixiu/pull/299#discussion_r747210869



##########
File path: pkg/client/mq/config.go
##########
@@ -0,0 +1,62 @@
+/*
+ * 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 mq
+
+import (
+	"time"
+)
+
+type (
+	Config struct {
+		ClientId            string              `yaml:"client_id" json:"client_id"`
+		Endpoints           string              `yaml:"endpoints" json:"endpoints"`
+		MqType              MQType              `yaml:"type" json:"type"`
+		Retry               int                 `yaml:"retry" json:"retry" default:"5"`
+		Timeout             time.Duration       `yaml:"timeout" json:"timeout" default:"2s"`
+		KafkaConsumerConfig KafkaConsumerConfig `yaml:"kafka_consumer_config" json:"kafka_consumer_config"`
+		KafkaProducerConfig KafkaProducerConfig `yaml:"kafka_producer_config" json:"kafka_producer_config"`
+	}
+
+	KafkaConsumerConfig struct {
+		Brokers         []string `yaml:"brokers" json:"brokers"`
+		ProtocolVersion string   `yaml:"protocol_version" json:"protocol_version"`
+		ClientID        string   `yaml:"client_id" json:"client_id"`
+		Metadata        Metadata `yaml:"metadata" json:"metadata"`
+	}
+
+	KafkaProducerConfig struct {
+		Brokers         []string `yaml:"brokers" json:"brokers"`
+		ProtocolVersion string   `yaml:"protocol_version" json:"protocol_version"`
+		Metadata        Metadata `yaml:"metadata" json:"metadata"`
+		Producer        Producer `yaml:"producer" json:"producer"`
+	}

Review comment:
       ```go
   Config struct {
   		ClientId            string              `yaml:"client_id" json:"client_id"`
   		Endpoints           string              `yaml:"endpoints" json:"endpoints"`
   		MqType              MQType              `yaml:"type" json:"type"`
   		Retry               int                 `yaml:"retry" json:"retry" default:"5"`
   		Timeout             time.Duration       `yaml:"timeout" json:"timeout" default:"2s"`
   	}
   
   	KafkaConsumerConfig struct {
                   Config
   		Brokers         []string `yaml:"brokers" json:"brokers"`
   		ProtocolVersion string   `yaml:"protocol_version" json:"protocol_version"`
   		ClientID        string   `yaml:"client_id" json:"client_id"`
   		Metadata        Metadata `yaml:"metadata" json:"metadata"`
   	}
   
   	KafkaProducerConfig struct {
                    Config
   		Brokers         []string `yaml:"brokers" json:"brokers"`
   		ProtocolVersion string   `yaml:"protocol_version" json:"protocol_version"`
   		Metadata        Metadata `yaml:"metadata" json:"metadata"`
   		Producer        Producer `yaml:"producer" json:"producer"`
   	}
   
   ```
   
   
   另外,建议封装一个 Config 接口




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org