samarap

package
v0.0.0-...-f48fc76 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchHandler

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

func NewBatchHandler

func NewBatchHandler[T any](l *zap.Logger, fn func(msgs []*sarama.ConsumerMessage, ts []T) error) *BatchHandler[T]

func (*BatchHandler[T]) Cleanup

func (b *BatchHandler[T]) Cleanup(session sarama.ConsumerGroupSession) error

func (*BatchHandler[T]) ConsumeClaim

func (b *BatchHandler[T]) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

func (*BatchHandler[T]) Setup

func (b *BatchHandler[T]) Setup(session sarama.ConsumerGroupSession) error

type Handler

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

Handler 是一个通用的消息处理器

func NewHandler

func NewHandler[T any](logger *zap.Logger, handle func(msg *sarama.ConsumerMessage, event T) error) *Handler[T]

NewHandler 创建一个新的 Handler 实例

func (*Handler[T]) Cleanup

func (h *Handler[T]) Cleanup(session sarama.ConsumerGroupSession) error

Cleanup 在消费组会话结束时调用

func (*Handler[T]) ConsumeClaim

func (h *Handler[T]) ConsumeClaim(session sarama.ConsumerGroupSession, claim sarama.ConsumerGroupClaim) error

ConsumeClaim 处理消费组的消息

func (*Handler[T]) Setup

func (h *Handler[T]) Setup(session sarama.ConsumerGroupSession) error

Setup 在消费组会话开始时调用

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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