fix(go): batch durable kafka replay
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user