kafka

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ACK_BEFORE_AUTO    = 0
	ACK_AFTER_NOERROR  = 1
	ACK_AFTER_NOMATTER = 2
)

Variables

This section is empty.

Functions

func InitKafka

func InitKafka()

Types

type Consumer

type Consumer interface {
	Close() error
	Consume(topics string, mh ConsumerMessageHandler, eh ConsumerErrorHandler) error
	ConsumeM(topics []string, mh ConsumerMessageHandler, eh ConsumerErrorHandler) error
}

func GetConsumer

func GetConsumer(key string) Consumer

type ConsumerErrorHandler

type ConsumerErrorHandler func(err error)

type ConsumerMessageHandler

type ConsumerMessageHandler func(msg *sarama.ConsumerMessage) error

type Producer

type Producer interface {
	Close() error
	Produce(msgs ...*sarama.ProducerMessage) error
	AsyncHandle(mh ProducerMessageHandler, eh ProducerErrorHandler) // 必须设置 asyncReturnSuccess 或 asyncReturnError
}

func GetProducer

func GetProducer(key string) Producer

type ProducerErrorHandler

type ProducerErrorHandler func(err *sarama.ProducerError)

type ProducerMessageHandler

type ProducerMessageHandler func(msg *sarama.ProducerMessage)

Jump to

Keyboard shortcuts

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