From 4c5b4a38fc092a8b01eeaa62cf3175c5c5d7d36e Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 8 Jun 2022 17:24:22 +0800 Subject: [PATCH] log --- pkg/common/kafka/producer.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/common/kafka/producer.go b/pkg/common/kafka/producer.go index fb922c5c0..1c7eeb6fb 100644 --- a/pkg/common/kafka/producer.go +++ b/pkg/common/kafka/producer.go @@ -33,12 +33,10 @@ func NewKafkaProducer(addr []string, topic string) *Producer { return &p } -func (p *Producer) SendMessage(m proto.Message, key ...string) (int32, int64, error) { +func (p *Producer) SendMessage(m proto.Message, key string) (int32, int64, error) { kMsg := &sarama.ProducerMessage{} kMsg.Topic = p.topic - if len(key) == 1 { - kMsg.Key = sarama.StringEncoder(key[0]) - } + kMsg.Key = sarama.StringEncoder(key) bMsg, err := proto.Marshal(m) if err != nil { log2.Error("", "", "proto marshal err = %s", err.Error())