Versions in this module Expand all Collapse all v0 v0.21.1 Apr 1, 2019 Changes in this version + const ErrAlreadyProcessing + const ErrDuplicatedJob + const ErrHandlerNotFound + const ErrInternal + const ErrQueueClosed + const ErrSubscriptionExists + const ErrSubscriptionNotFound + const MockAdd + const MockClose + const MockProcess + const MockSubscribe + const MockUnsubscribe + func AddSimple(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string) error + func AddWithData(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, ...) error + func AddWithDataAndDelay(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, ...) error + func AddWithDelay(q Queue, tx *reform.TX, jobType, relatedType, relatedID, creator string, ...) error + type Config struct + CollectJobs uint + CollectPeriod uint + Types map[string]TypeConfig + WorkerBufLen uint + Workers uint + func NewConfig() *Config + type Handler func(j *data.Job) error + type HandlerMap map[string]Handler + type Queue interface + Add func(tx *reform.TX, j *data.Job) error + Close func() + Process func() error + Subscribe func(subKeys []string, subID string, subFunc SubFunc) error + Unsubscribe func(subKeys []string, subID string) error + func NewQueue(conf *Config, logger log.Logger, db *reform.DB, handlers HandlerMap) Queue + type QueueMock func(method int, tx *reform.TX, job *data.Job, relatedIDs []string, subID string, ...) error + func NewDummyQueueMock() QueueMock + func (q QueueMock) Add(tx *reform.TX, j *data.Job) error + func (q QueueMock) Close() + func (q QueueMock) Process() error + func (q QueueMock) Subscribe(relatedIDs []string, subID string, subFunc SubFunc) error + func (q QueueMock) Unsubscribe(relatedIDs []string, subID string) error + type SubFunc func(job *data.Job, result error) + type TypeConfig struct + Duplicated bool + FirstStartDelay uint + TryLimit uint8 + TryPeriod uint