Skip to content

Commit

Permalink
Add batcher method for owned output
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffail committed May 22, 2024
1 parent 8534a88 commit c11a4d5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions public/service/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync/atomic"

"github.com/benthosdev/benthos/v4/internal/component/output"
"github.com/benthosdev/benthos/v4/internal/component/output/batcher"
"github.com/benthosdev/benthos/v4/internal/message"
)

Expand Down Expand Up @@ -184,6 +185,14 @@ func newOwnedOutput(o output.Streamed) (*OwnedOutput, error) {
}, nil
}

// BatchedWith returns a copy of the OwnedOutput where messages will be batched
// according to the provided batcher.
func (o *OwnedOutput) BatchedWith(b *Batcher) *OwnedOutput {
return &OwnedOutput{
o: batcher.New(b.p, o.o, b.mgr),
}
}

// Prime attempts to establish the output connection ready for consuming data.
// This is done automatically once data is written. However, pre-emptively
// priming the connection before data is received is generally a better idea for
Expand Down

0 comments on commit c11a4d5

Please sign in to comment.