kafka

package
v0.0.0-...-a3cb3ec Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConsumerGroup

func NewConsumerGroup(nodes []*conf.Kafka_Consumer)

func NewConsumerWorker

func NewConsumerWorker(nodes []*conf.Kafka_Consumer) error

NewConsumerWorker yaml配置topic对于的func调用链式实例

func Register

func Register(name string, maker Handler)

func RegisterConsumer

func RegisterConsumer(nodes []*conf.Kafka_Consumer) error

func RegisterProducer

func RegisterProducer(nodes []*conf.Kafka_Producer) error

Types

type Consumer

type Consumer struct{}

func (Consumer) Cleanup

func (Consumer) ConsumeClaim

func (c Consumer) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

func (Consumer) Setup

type Handler

type Handler interface {
	Do(ctx context.Context, msg *sarama.ConsumerMessage) error
	SetNext(h Handler) Handler
	Run(ctx context.Context, msg *sarama.ConsumerMessage) error
}

func HandlerInterface

func HandlerInterface() Handler

type NullHandler

type NullHandler struct {
	WorkerHandler
}

首链

func (*NullHandler) Do

func (h *NullHandler) Do(ctx context.Context, msg *sarama.ConsumerMessage) (err error)

type Producer

type Producer struct {
	Topic        string              `json:"topic"`
	SyncProducer sarama.SyncProducer `json:"map"`
}

func NewProducer

func NewProducer(topic string) (*Producer, error)

func (*Producer) Send

func (p *Producer) Send(data string) error

type WorkerHandler

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

func (*WorkerHandler) Run

func (n *WorkerHandler) Run(ctx context.Context, msg *sarama.ConsumerMessage) (err error)

func (*WorkerHandler) SetNext

func (n *WorkerHandler) SetNext(h Handler) Handler

Jump to

Keyboard shortcuts

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