redisdelaymq

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayQueue

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

DelayQueue 延迟队列.

func New

func New(topic string, delay time.Duration, opts ...Option) *DelayQueue

New 新建延迟队列实例.

func (*DelayQueue) Consume

func (d *DelayQueue) Consume(ctx context.Context, timestamp int64) (gvar.Vars, error)

Consume 获取score小于给定时间戳(一般为消费的当前时间戳)的所有消息.

func (*DelayQueue) Produce

func (d *DelayQueue) Produce(ctx context.Context, messages []interface{}) error

Produce 将一个或多个消息放到延迟队列.

func (*DelayQueue) Remove

func (d *DelayQueue) Remove(ctx context.Context, timestamp int64) (int64, error)

Remove 删除score小于给定时间戳(一般为传给Consume方法的时间戳)的所有消息.

func (*DelayQueue) RemoveByMsg

func (d *DelayQueue) RemoveByMsg(ctx context.Context, message interface{}) (int64, error)

Remove 删除指定消息.

type Option

type Option func(*Options)

Option 配置项.

func WithRedisGroup

func WithRedisGroup(group string) Option

WithRedisGroup 设置使用配置的哪组redis服务器(或集群).

type Options

type Options struct {
	Group string
}

Options 可选配置项.

Jump to

Keyboard shortcuts

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