tkafka

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultBrokerAddress = []string{"127.0.0.1:9092"}
)

Functions

func BrokerAddress

func BrokerAddress() []string

func Config

func Config() wkafka.Config

Config returns the default configuration for Kafka for testing.

func Consume added in v0.3.2

func Consume[T any](ctx context.Context, cfg ReadConfig, fn func(ctx context.Context, data T) error) error

Consume for testing creating client and start consuming messages to your function.

  • Cancel the context to stop this function.

func TestClient

func TestClient(opts ...OptionTestClient) (*wkafka.Client, error)

Types

type Generate

type Generate struct {
	Topics map[string]struct{}
	// contains filtered or unexported fields
}

func NewGenerate

func NewGenerate(c *wkafka.Client) *Generate

func (*Generate) Cleanup

func (g *Generate) Cleanup() (kadm.DeleteTopicResponses, error)

func (*Generate) CreateTopics

func (g *Generate) CreateTopics(ctx context.Context, topics ...Topic) ([]kadm.CreateTopicResponse, error)

func (*Generate) DeleteGroups added in v0.3.2

func (g *Generate) DeleteGroups(ctx context.Context, groups ...string) (kadm.DeleteGroupResponses, error)

func (*Generate) DeleteTopics added in v0.3.2

func (g *Generate) DeleteTopics(ctx context.Context, topics ...string) (kadm.DeleteTopicResponses, error)

type OptionTestClient added in v0.3.2

type OptionTestClient func(*optionTestClient)

func WithConfig added in v0.3.2

func WithConfig(cfg wkafka.Config) OptionTestClient

func WithContext added in v0.3.2

func WithContext(ctx context.Context) OptionTestClient

func WithWafkaOptions added in v0.3.2

func WithWafkaOptions(opts ...wkafka.Option) OptionTestClient

type ReadConfig added in v0.3.2

type ReadConfig struct {
	Name string

	KafkaConfig   wkafka.Config
	KafkaConsumer wkafka.ConsumerConfig
}

type Topic

type Topic struct {
	Name string

	// Partitions defaults to -1, which means the broker default.
	Partitions int32
	// ReplicationFactor defaults to -1, which means the broker default.
	ReplicationFactor int16
}

Jump to

Keyboard shortcuts

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