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())