1
0
mirror of https://github.com/netsampler/goflow2.git synced 2024-05-06 15:54:52 +00:00

bug: fix kafka transport default partitioning (#246)

This commit is contained in:
Louis
2023-12-06 13:53:51 +01:00
committed by GitHub
parent 3c00d97a67
commit 5ba02103eb
2 changed files with 4 additions and 3 deletions

View File

@ -39,9 +39,6 @@ func (m *ProtoProducerMessage) MarshalText() ([]byte, error) {
}
func (m *ProtoProducerMessage) baseKey(h hash.Hash) {
if m.formatter == nil || len(m.formatter.key) == 0 {
return
}
vfm := reflect.ValueOf(m)
vfm = reflect.Indirect(vfm)
@ -72,6 +69,9 @@ func (m *ProtoProducerMessage) baseKey(h hash.Hash) {
}
func (m *ProtoProducerMessage) Key() []byte {
if m.formatter == nil || len(m.formatter.key) == 0 {
return nil
}
h := fnv.New32()
m.baseKey(h)
return h.Sum(nil)

View File

@ -120,6 +120,7 @@ func (d *KafkaDriver) Init() error {
kafkaConfig.Producer.MaxMessageBytes = d.kafkaMaxMsgBytes
kafkaConfig.Producer.Flush.Bytes = d.kafkaFlushBytes
kafkaConfig.Producer.Flush.Frequency = d.kafkaFlushFrequency
kafkaConfig.Producer.Partitioner = sarama.NewRoundRobinPartitioner
if d.kafkaCompressionCodec != "" {
/*