kafkax

package
v0.0.0-...-322c5b9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReaderClosed = errors.New("kafka reader closed")
)

Functions

This section is empty.

Types

type BulkHandler

type BulkHandler[T any] struct {
	// contains filtered or unexported fields
}

func NewBulkHandler

func NewBulkHandler[T any](logger *slog.Logger,
	fn func(ctx context.Context, msg []kafka.Message, t []T) error) *BulkHandler[T]

func (*BulkHandler[T]) Close

func (h *BulkHandler[T]) Close()

func (*BulkHandler[T]) ReadMsg

func (h *BulkHandler[T]) ReadMsg(ctx context.Context, r *kafka.Reader) error

func (*BulkHandler[T]) SetBatchSize

func (h *BulkHandler[T]) SetBatchSize(batchSize int) *BulkHandler[T]

func (*BulkHandler[T]) SetDecodeFn

func (h *BulkHandler[T]) SetDecodeFn(fn func([]byte) (T, error)) *BulkHandler[T]

func (*BulkHandler[T]) SetInterval

func (h *BulkHandler[T]) SetInterval(interval time.Duration) *BulkHandler[T]

type Consumer

type Consumer interface {
	Start() error
}

type Handler

type Handler[T any] struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler[T any](logger *slog.Logger,
	fn func(ctx context.Context, msg kafka.Message, t T) error) *Handler[T]

func (*Handler[T]) Close

func (h *Handler[T]) Close()

func (*Handler[T]) ReadMsg

func (h *Handler[T]) ReadMsg(ctx context.Context, r *kafka.Reader) error

func (*Handler[T]) SetDecodeFn

func (h *Handler[T]) SetDecodeFn(fn func([]byte) (T, error)) *Handler[T]

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳