Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PushToBucket ¶
PushToBucket 添加JobId到bucket中
func RemoveFromBucket ¶
RemoveFromBucket 从bucket中删除JobId
Types ¶
type BucketItem ¶
BucketItem bucket中的元素
func GetFromBucket ¶
func GetFromBucket(key string) (*BucketItem, error)
GetFromBucket 从bucket中获取延迟时间最小的JobId
type Job ¶
type Job struct { // Job类型 Topic string `json:"topic" msgpack:"1"` // job唯一标识ID,需确保Job ID唯一 Id string `json:"id" msgpack:"2"` // Job需要延迟的时间, unix时间戳,单位:秒 Delay int64 `json:"delay" msgpack:"3"` // Job的内容,供消费者做具体的业务处理,如果是json格式需转义 Body string `json:"body" msgpack:"4"` }
Job 使用msgpack序列化后保存到Redis,减少内存占用 Job存储结构:String;key为Job id,value为job元信息
Click to show internal directories.
Click to hide internal directories.