client

package
v3.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReaderClient

func NewReaderClient(kafkaCfg kafka.Config, metrics *kprom.Metrics, logger log.Logger, opts ...kgo.Opt) (*kgo.Client, error)

NewReaderClient returns the kgo.Client that should be used by the Reader.

func NewReaderClientMetrics

func NewReaderClientMetrics(component string, reg prometheus.Registerer) *kprom.Metrics

func NewWriterClient

func NewWriterClient(kafkaCfg kafka.Config, maxInflightProduceRequests int, logger log.Logger, reg prometheus.Registerer) (*kgo.Client, error)

NewWriterClient returns the kgo.Client that should be used by the Writer.

The input prometheus.Registerer must be wrapped with a prefix (the names of metrics registered don't have a prefix).

Types

type Producer

type Producer struct {
	*kgo.Client
	// contains filtered or unexported fields
}

Producer is a kgo.Client wrapper exposing some higher level features and metrics useful for producers.

func NewProducer

func NewProducer(client *kgo.Client, maxBufferedBytes int64, reg prometheus.Registerer) *Producer

NewProducer returns a new KafkaProducer.

The input prometheus.Registerer must be wrapped with a prefix (the names of metrics registered don't have a prefix).

func (*Producer) Close

func (c *Producer) Close()

func (*Producer) ProduceSync

func (c *Producer) ProduceSync(ctx context.Context, records []*kgo.Record) kgo.ProduceResults

ProduceSync produces records to Kafka and returns once all records have been successfully committed, or an error occurred.

This function honors the configure max buffered bytes and refuse to produce a record, returnin kgo.ErrMaxBuffered, if the configured limit is reached.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL