add ability to fail probes and fatal on broker errors
All checks were successful
test / test (push) Successful in 3m12s

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2025-02-26 11:06:11 +03:00
parent cfecb4afd0
commit aaf8c43e04
8 changed files with 186 additions and 90 deletions

View File

@@ -50,7 +50,8 @@ type Subscriber struct {
connected *atomic.Uint32
sync.RWMutex
closed bool
closed bool
fatalOnError bool
}
func (s *Subscriber) Client() *kgo.Client {
@@ -174,6 +175,9 @@ func (s *Subscriber) killConsumers(ctx context.Context, lost map[string][]int32)
func (s *Subscriber) autocommit(_ *kgo.Client, _ *kmsg.OffsetCommitRequest, _ *kmsg.OffsetCommitResponse, err error) {
if err != nil {
s.connected.Store(0)
if s.fatalOnError {
s.kopts.Logger.Fatal(context.TODO(), "kgo.AutoCommitCallback error", err)
}
}
}