Compare commits

...

2 Commits

Author SHA1 Message Date
8a069e9faf Merge pull request 'correction create opts' (#159) from devstigneev/micro-broker-kgo:v3_fix_opts into v3
Some checks failed
test / test (push) Failing after 17m33s
coverage / build (push) Failing after 17m44s
Reviewed-on: #159
2026-01-30 09:48:26 +03:00
Evstigneev Denis
79d80a6fc8 correction create opts
Some checks failed
coverage / build (pull_request) Failing after 3m48s
test / test (pull_request) Failing after 3m40s
lint / lint (pull_request) Failing after 4m2s
2026-01-30 09:45:00 +03:00

29
kgo.go
View File

@@ -477,19 +477,22 @@ func (k *Broker) Subscribe(ctx context.Context, topic string, handler broker.Han
connected: k.connected, connected: k.connected,
} }
kopts := append(k.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),
},
k.kopts...,
) )
if options.Context != nil { if options.Context != nil {