Documentation
¶
Index ¶
- Constants
- type BucketItem
- type DelayRedisQueue
- func (q *DelayRedisQueue) Get(ctx context.Context, jobId string) (*Job, error)
- func (q *DelayRedisQueue) Pop(ctx context.Context, topics []string) (*Job, error)
- func (q *DelayRedisQueue) Push(ctx context.Context, job Job) error
- func (q *DelayRedisQueue) Remove(ctx context.Context, jobId string) error
- type Job
Constants ¶
View Source
const (
DefaultQueueBlockTimeout = 10 * time.Second
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketItem ¶
type BucketItem struct {
// contains filtered or unexported fields
}
BucketItem bucket中的元素
type DelayRedisQueue ¶
type DelayRedisQueue struct {
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, name string, bucketCnt int, redisClient *redis.Client) *DelayRedisQueue
type Job ¶
type Job struct { Topic string `json:"topic" msgpack:"1"` Id string `json:"id" msgpack:"2"` // job唯一标识ID Delay int64 `json:"delay" msgpack:"3"` // 延迟时间, 单位为s TTR int64 `json:"ttr" msgpack:"4"` // Time-To-Retry,失败后,多久再次重试 Body string `json:"body" msgpack:"5"` }
Job 使用msgpack序列化后保存到Redis,减少内存占用
Click to show internal directories.
Click to hide internal directories.