kafka

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Committer added in v0.0.9

type Committer interface {
	Commit(ctx context.Context) error
}

type Handler

type Handler interface {
	Handle(ctx context.Context, msg Message) error
}

type Handlers

type Handlers map[string]Handler

Handlers represents Topic -> Handler mapping

type Header interface {
	Key() string
	Value() []byte
}

type Listener

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

func NewListener

func NewListener(reader Reader, handlers Handlers, opts ...ListenerOption) (*Listener, error)

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Listen

func (l *Listener) Listen(ctx context.Context) error

type ListenerOption

type ListenerOption func(*Listener)

func ListenerAsyncHandle added in v0.1.1

func ListenerAsyncHandle(asyncHandle bool) ListenerOption

func ListenerErrorHandler

func ListenerErrorHandler(errHandler transport.ErrorHandler) ListenerOption

func ListenerErrorLogger

func ListenerErrorLogger(logger log.Logger) ListenerOption

func ListenerManualCommit added in v0.0.10

func ListenerManualCommit(manualCommit bool) ListenerOption

type Message

type Message interface {
	Topic() string
	Partition() int
	Offset() int64
	Key() []byte
	Value() []byte
	Headers() []Header
	Timestamp() time.Time
}

type NoopErrorHandler added in v0.0.6

type NoopErrorHandler struct {
}

func NewNoopErrorHandler added in v0.0.6

func NewNoopErrorHandler() *NoopErrorHandler

func (*NoopErrorHandler) Handle added in v0.0.6

func (eh *NoopErrorHandler) Handle(context.Context, error)

type Reader

type Reader interface {
	ReadMessage(ctx context.Context) (Message, error)
	Committer
	io.Closer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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