reader

package
v0.2.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterReaderFactory

func RegisterReaderFactory(protocol string, factory ReaderFactoryFunc)

Types

type Reader

type Reader interface {
	Subscribe(ctx context.Context, h func(message []byte, topic string, args ...any)) error
	HSubscribe(ctx context.Context, h func(message []byte, topic string, hs [][]byte, args ...any)) error
	Fetch(
		ctx context.Context, n uint32,
		fetchResponseHandler func(n uint32, err error),
		msgHandler func(message []byte, topic string, args ...any),
	)
	HFetch(
		ctx context.Context, n uint32,
		fetchResponseHandler func(n uint32, err error),
		msgHandler func(message []byte, topic string, hs [][]byte, args ...any),
	)
	Ack(
		ctx context.Context, msgIDs [][]byte,
		ackHandler func(error),
		ackMsgHandler func([]byte, error),
	)
	Nack(
		ctx context.Context, msgIDs [][]byte,
		nackHandler func(error),
		nackMsgHandler func([]byte, error),
	)
	MsgIDStaticArgsLen() int
	EncodeMsgID(buf []byte, topic string, args ...any) []byte
	IsAutoCommit() bool
	Close()
}

func New

func New(conf config.Config, autoCommit bool, l *slog.Logger) (Reader, error)

type ReaderFactoryFunc

type ReaderFactoryFunc func(brokerSpecificConfig any, autoCommit bool, l *slog.Logger) (Reader, error)

type ReaderType

type ReaderType byte
const (
	Unknown ReaderType = iota
	Subscriber
	Consumer
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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