| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
package queuebatch |
| 5 |
|
| 6 |
import ( |
| 7 |
"context" |
| 8 |
|
| 9 |
"go.opentelemetry.io/collector/component" |
| 10 |
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/queue" |
| 11 |
"go.opentelemetry.io/collector/exporter/exporterhelper/internal/sender" |
| 12 |
) |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
type disabledBatcher[T any] struct { |
| 17 |
component.StartFunc |
| 18 |
component.ShutdownFunc |
| 19 |
consumeFunc sender.SendFunc[T] |
| 20 |
} |
| 21 |
|
| 22 |
func (db *disabledBatcher[T]) Consume(ctx context.Context, req T, done queue.Done) { |
| 23 |
done.OnDone(db.consumeFunc(ctx, req)) |
| 24 |
} |
| 25 |
|
| 26 |
func newDisabledBatcher[T any](consumeFunc sender.SendFunc[T]) Batcher[T] { |
| 27 |
return &disabledBatcher[T]{consumeFunc: consumeFunc} |
| 28 |
} |