Documentation ¶
Index ¶
- type MQRedisDelay
- type RedisDelayQueue
- func (r *RedisDelayQueue) Acknowledge(keys ...string) int64
- func (r *RedisDelayQueue) Add(value interface{}, delay int64) int64
- func (r *RedisDelayQueue) Adds(values ...interface{}) int64
- func (r *RedisDelayQueue) Remove(value ...interface{}) int64
- func (r *RedisDelayQueue) Take(count int64) []string
- func (r *RedisDelayQueue) TakeOne(timeout ...int64) string
- func (r *RedisDelayQueue) TakeOneBlock(ctx context.Context, timeout ...int64) string
- func (r *RedisDelayQueue) TransferAsync(ctx context.Context)
- func (r *RedisDelayQueue) TryPop(value interface{}) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MQRedisDelay ¶
type MQRedisDelay struct {
// contains filtered or unexported fields
}
func NewMQRedisDelay ¶
func NewMQRedisDelay(client cache.ICache, logger glog.ILogger) *MQRedisDelay
func (*MQRedisDelay) GetRedisDelay ¶
func (r *MQRedisDelay) GetRedisDelay(topic string) *RedisDelayQueue
type RedisDelayQueue ¶
type RedisDelayQueue struct { DB int // 失败时抛出异常。默认false ThrowOnFailure bool //发送消息失败时的重试次数。默认3次 RetryTimesWhenSendFailed int // 重试间隔。默认1000ms RetryIntervalWhenSendFailed int //消息队列主题 Topic string // 转移延迟消息到主队列的间隔。默认10s TransferInterval int64 // 个数 Count int64 IsEmpty bool // 默认延迟时间。默认60秒 Delay int64 // contains filtered or unexported fields }
func NewRedisDelay ¶
func (*RedisDelayQueue) Acknowledge ¶
func (r *RedisDelayQueue) Acknowledge(keys ...string) int64
Acknowledge 确认删除
func (*RedisDelayQueue) Add ¶
func (r *RedisDelayQueue) Add(value interface{}, delay int64) int64
Add 添加延迟消息
func (*RedisDelayQueue) Adds ¶
func (r *RedisDelayQueue) Adds(values ...interface{}) int64
Adds 批量生产
func (*RedisDelayQueue) Remove ¶
func (r *RedisDelayQueue) Remove(value ...interface{}) int64
Remove 删除项
func (*RedisDelayQueue) TakeOne ¶
func (r *RedisDelayQueue) TakeOne(timeout ...int64) string
TakeOne timeout 超时时间,默认0秒永远阻塞;负数表示直接返回,不阻塞。获取一个
func (*RedisDelayQueue) TakeOneBlock ¶
func (r *RedisDelayQueue) TakeOneBlock(ctx context.Context, timeout ...int64) string
TakeOneBlock timeout 超时时间,默认0秒永远阻塞;负数表示直接返回,不阻塞。异步获取一个
func (*RedisDelayQueue) TransferAsync ¶
func (r *RedisDelayQueue) TransferAsync(ctx context.Context)
func (*RedisDelayQueue) TryPop ¶
func (r *RedisDelayQueue) TryPop(value interface{}) bool
TryPop 争夺消费,只有一个线程能够成功删除,
Click to show internal directories.
Click to hide internal directories.