fix(go): batch durable kafka replay

This commit is contained in:
lingniu
2026-07-02 14:01:50 +08:00
parent c939cc6b0c
commit 5a958616a3
5 changed files with 176 additions and 5 deletions

View File

@@ -40,6 +40,29 @@ func (s *RetryingSink) PublishUnified(ctx context.Context, env envelope.FrameEnv
})
}
func (s *RetryingSink) PublishRecords(ctx context.Context, records []durableRecord) error {
if publisher, ok := s.delegate.(recordPublishingSink); ok {
return s.withRetry(ctx, func(attemptCtx context.Context) error {
return publisher.PublishRecords(attemptCtx, records)
})
}
for _, record := range records {
switch record.Kind {
case "raw":
if err := s.PublishRaw(ctx, record.Envelope); err != nil {
return err
}
case "unified":
if err := s.PublishUnified(ctx, record.Envelope); err != nil {
return err
}
default:
return errUnknownRecordKind(record.Kind)
}
}
return nil
}
func (s *RetryingSink) Close() error {
return s.delegate.Close()
}