Reference
Constructor
func New(opts Options) (*Queue, error)
Creates a queue. Options are described on the configuration page; anything left unset uses its default.
Enqueue
func (q *Queue) Enqueue(ctx context.Context, kind string, payload []byte) (int, error)
Adds a job and returns its id.
Schedule
func (q *Queue) Schedule(ctx context.Context, kind string, delay time.Duration) (int, error)
Adds a job that becomes available after the delay.
Cancel
func (q *Queue) Cancel(ctx context.Context, id int) (bool, error)
Cancels a job that has not started yet.
Pending
func (q *Queue) Pending(ctx context.Context) (int, error)
Returns the number of jobs waiting to run.
Run
func (q *Queue) Run(ctx context.Context) error
Starts workers and blocks until shutdown.