kafka

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2024 License: MIT Imports: 6 Imported by: 0

README

kafka

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonKafka

type CommonKafka interface {
	GetKafkaWriter() Writer
	Close()
	SetLog(Logger)
}

func NewCommonKafka

func NewCommonKafka(ctx context.Context, di ConfigDI, topic string) CommonKafka

type ConfigDI

type ConfigDI interface {
	NewKafkaWriter(ctx context.Context, topic string) Writer
	NewKafkaReader(ctx context.Context, groupID, topic string) Reader
}

type KafkaConfig

type KafkaConfig struct {
	Brokers []string
}

func (*KafkaConfig) NewKafkaReader

func (c *KafkaConfig) NewKafkaReader(ctx context.Context, groupID, topic string) Reader

func (*KafkaConfig) NewKafkaWriter

func (c *KafkaConfig) NewKafkaWriter(ctx context.Context, topic string) Writer

type Logger

type Logger interface {
	Debug(string)
	Info(string)
}

type Reader

type Reader interface {
	Read() (map[string]string, []byte, error)
	ReadHandler(handler ReaderHandler) error
	Close() error
}

type ReaderHandler

type ReaderHandler func(headers map[string]string, data []byte) error

type Writer

type Writer interface {
	SetLog(Logger)
	Message(headers map[string][]byte, msg []byte) error
	Close() error
}

Jump to

Keyboard shortcuts

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