correction create opts #160

Merged
vtolstov merged 1 commits from devstigneev/micro-broker-kgo:fix_opts into v4 2026-01-30 09:58:19 +03:00

29
kgo.go
View File

@@ -568,19 +568,22 @@ func (b *Broker) fnSubscribe(ctx context.Context, topic string, handler interfac
messagePool: messagePool, messagePool: messagePool,
} }
kopts := append(b.kopts, kopts := append(
kgo.ConsumerGroup(options.Group), []kgo.Opt{
kgo.ConsumeTopics(topic), kgo.ConsumerGroup(options.Group),
kgo.ConsumeResetOffset(kgo.NewOffset().AtStart()), kgo.ConsumeTopics(topic),
kgo.FetchMaxWait(1*time.Second), kgo.ConsumeResetOffset(kgo.NewOffset().AtStart()),
kgo.AutoCommitInterval(commitInterval), kgo.FetchMaxWait(1 * time.Second),
kgo.OnPartitionsAssigned(sub.assigned), kgo.AutoCommitInterval(commitInterval),
kgo.OnPartitionsRevoked(sub.revoked), kgo.OnPartitionsAssigned(sub.assigned),
kgo.StopProducerOnDataLossDetected(), kgo.OnPartitionsRevoked(sub.revoked),
kgo.OnPartitionsLost(sub.lost), kgo.StopProducerOnDataLossDetected(),
kgo.AutoCommitCallback(sub.autocommit), kgo.OnPartitionsLost(sub.lost),
kgo.AutoCommitMarks(), kgo.AutoCommitCallback(sub.autocommit),
kgo.WithHooks(sub), kgo.AutoCommitMarks(),
kgo.WithHooks(sub),
},
b.kopts...,
) )
if options.Context != nil { if options.Context != nil {