destination

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package destination is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	sdk.DefaultDestinationMiddleware
	common.Config

	// Topic is the Kafka topic. It can contain a [Go template](https://pkg.go.dev/text/template)
	// that will be executed for each record to determine the topic. By default,
	// the topic is the value of the `opencdc.collection` metadata field.
	Topic string `json:"topic" default:"{{ index .Metadata \"opencdc.collection\" }}"`
	// Acks defines the number of acknowledges from partition replicas required
	// before receiving a response to a produce request.
	// None = fire and forget, one = wait for the leader to acknowledge the
	// writes, all = wait for the full ISR to acknowledge the writes.
	Acks string `json:"acks" default:"all" validate:"inclusion=none|one|all"`
	// DeliveryTimeout for write operation performed by the Writer.
	DeliveryTimeout time.Duration `json:"deliveryTimeout"`
	// Compression set the compression codec to be used to compress messages.
	Compression string `json:"compression" default:"snappy" validate:"inclusion=none|gzip|snappy|lz4|zstd"`
	// BatchBytes limits the maximum size of a request in bytes before being
	// sent to a partition. This mirrors Kafka's max.message.bytes.
	BatchBytes int32 `json:"batchBytes" default:"1000012"`
	// contains filtered or unexported fields
}

func (*Config) CompressionCodecs

func (c *Config) CompressionCodecs() []kgo.CompressionCodec

func (*Config) ParseTopic added in v0.8.0

func (c *Config) ParseTopic() (topic string, f TopicFn, err error)

ParseTopic returns either a static topic or a function that determines the topic for each record individually. If the topic is neither static nor a template, an error is returned.

func (*Config) RequiredAcks

func (c *Config) RequiredAcks() kgo.Acks

func (*Config) Validate

func (c *Config) Validate(ctx context.Context) error

Validate executes manual validations beyond what is defined in struct tags.

func (*Config) WithKafkaConnectKeyFormat

func (c *Config) WithKafkaConnectKeyFormat()

type FranzProducer

type FranzProducer struct {
	// contains filtered or unexported fields
}

func NewFranzProducer

func NewFranzProducer(ctx context.Context, cfg Config) (*FranzProducer, error)

func (*FranzProducer) Close

func (p *FranzProducer) Close(_ context.Context) error

func (*FranzProducer) Produce

func (p *FranzProducer) Produce(ctx context.Context, records []opencdc.Record) (int, error)

type MockProducer

type MockProducer struct {
	// contains filtered or unexported fields
}

MockProducer is a mock of Producer interface.

func NewMockProducer

func NewMockProducer(ctrl *gomock.Controller) *MockProducer

NewMockProducer creates a new mock instance.

func (*MockProducer) Close

func (m *MockProducer) Close(arg0 context.Context) error

Close mocks base method.

func (*MockProducer) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockProducer) Produce

func (m *MockProducer) Produce(arg0 context.Context, arg1 []opencdc.Record) (int, error)

Produce mocks base method.

type MockProducerMockRecorder

type MockProducerMockRecorder struct {
	// contains filtered or unexported fields
}

MockProducerMockRecorder is the mock recorder for MockProducer.

func (*MockProducerMockRecorder) Close

func (mr *MockProducerMockRecorder) Close(arg0 any) *gomock.Call

Close indicates an expected call of Close.

func (*MockProducerMockRecorder) Produce

func (mr *MockProducerMockRecorder) Produce(arg0, arg1 any) *gomock.Call

Produce indicates an expected call of Produce.

type Producer

type Producer interface {
	// Produce sends all records to Kafka synchronously.
	Produce(context.Context, []opencdc.Record) (int, error)
	// Close this producer and the associated resources.
	Close(context.Context) error
}

Producer is a kafka producer.

type TopicFn added in v0.8.0

type TopicFn func(opencdc.Record) (string, error)

Jump to

Keyboard shortcuts

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