Documentation
¶
Index ¶
Constants ¶
View Source
const ( KindRedis = "redis" KindRedisV2 = "redis_v2" KindMigration = "migration" )
Variables ¶
Functions ¶
func ExistsPool ¶
func GetPoolsByKind ¶
Types ¶
type CreateJobReq ¶ added in v1.0.12
type Engine ¶
type Engine interface {
Publish(job Job) (jobID string, err error)
Consume(namespace string, queues []string, ttrSecond, timeoutSecond uint32) (job Job, err error)
BatchConsume(namespace string, queues []string, count, ttrSecond, timeoutSecond uint32) (jobs []Job, err error)
Delete(namespace, queue, jobID string) error
Peek(namespace, queue, optionalJobID string) (job Job, err error)
Size(namespace, queue string) (size int64, err error)
Destroy(namespace, queue string) (count int64, err error)
// Dead letter
PeekDeadLetter(namespace, queue string) (size int64, jobID string, err error)
DeleteDeadLetter(namespace, queue string, limit int64) (count int64, err error)
RespawnDeadLetter(namespace, queue string, limit, ttlSecond int64) (count int64, err error)
SizeOfDeadLetter(namespace, queue string) (size int64, err error)
Shutdown()
DumpInfo(output io.Writer) error
}
func GetEngineByKind ¶
type Job ¶
type Job interface {
Namespace() string
Queue() string
ID() string
Body() []byte
TTL() uint32
Delay() uint32
Tries() uint16
ElapsedMS() int64
Attributes() map[string]string
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
encoding.TextMarshaler
}
func NewJob ¶
func NewJob(namespace, queue string, body []byte, ttl, delay uint32, tries uint16, jobID string) Job
NOTE: there is a trick in this factory, the delay is embedded in the jobID. By doing this we can delete the job that's located in hourly AOF, by placing a tombstone record in that AOF.
func NewJobFromReq ¶ added in v1.0.12
func NewJobFromReq(req *CreateJobReq) Job
NewJobFromReq creates a new job with its body and attributes being marshalled
Click to show internal directories.
Click to hide internal directories.