toolqueue

package
v0.0.0-...-6420be8 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrQueueFull = fmt.Errorf("消息写入失败队列已满")

Functions

This section is empty.

Types

type Queue

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

Queue 进程内消息队列 支持批量处理 优雅重启

func NewQueue

func NewQueue[T any](MaxLen int, ConsumeFunc func(QueueName QueueName, dataList []T)) *Queue[T]

func (*Queue[T]) Publish

func (s *Queue[T]) Publish(QueueName QueueName, data T) error

func (*Queue[T]) SetLogCb

func (s *Queue[T]) SetLogCb(errorLogCb func(msg error), infoLogCb func(msg string), debugLogCb func(msg string))

SetLogCb 设置错误回调函数

func (*Queue[T]) Start

func (s *Queue[T]) Start()

func (*Queue[T]) Stop

func (s *Queue[T]) Stop()

关闭队列

func (*Queue[T]) Wait

func (s *Queue[T]) Wait() error

等待队列内的消息消费完

type QueueName

type QueueName string

Jump to

Keyboard shortcuts

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