httpsqsconsumer

package
v0.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...func(consumer *consumer)) queue.IConsumer

func WithHandler

func WithHandler(handler IHandler) func(*consumer)

WithHandler 设置消费者处理器

func WithLogger

func WithLogger(log xlog.XLogger) func(*consumer)

WithLogger 设置日志器

func WithMaxRetry

func WithMaxRetry(count uint) func(*consumer)

WithMaxRetry 设置重试次数

Types

type IHandler

type IHandler interface {
	// QueueName 需要处理的队列名
	QueueName() string

	// GetClient 获取 HTTPSQS 客户端
	GetClient() (httpsqs.IClient, error)

	// OnBefore 前置操作
	OnBefore(ctx context.Context) error

	// Handle 消费队列数据
	Handle(ctx context.Context, data string, pos int64) error

	// OnFailed 失败回调
	OnFailed(ctx context.Context, data string, err error)
}

IHandler HTTPSQS 队列消费者处理接口

Jump to

Keyboard shortcuts

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