Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultWorker ¶
type DefaultWorker struct{}
type PoolOptionFunc ¶
type PoolOptionFunc func(p *WorkerPool) *WorkerPool
func WithAdminUI ¶
func WithAdminUI(addr string) PoolOptionFunc
func WithErrorHandler ¶
func WithErrorHandler(f func(error)) PoolOptionFunc
func WithGracefulShutdown ¶
func WithGracefulShutdown() PoolOptionFunc
func WithReaperInterval ¶
func WithReaperInterval(interval time.Duration) PoolOptionFunc
func WithSchedulerInterval ¶
func WithSchedulerInterval(interval time.Duration) PoolOptionFunc
type Queue ¶
type Queue interface { Poll(ctx context.Context) (jobs.Job, error) RequeueTimedOutJobs(ctx context.Context, timeout time.Duration) error }
Queue is a queue of jobs.
type Worker ¶
type Worker interface { Execute(ctx context.Context, job jobs.Job) (interface{}, error) OnFailure(ctx context.Context, job jobs.Job) error }
Worker is the interface that must be implemented by workers.
type WorkerFunc ¶
WorkerFunc is a function that can be used as a worker.
type WorkerOptionFunc ¶
type WorkerOptionFunc func(workerConfig) workerConfig
func WithInstances ¶
func WithInstances(i int) WorkerOptionFunc
func WithTimeout ¶
func WithTimeout(d time.Duration) WorkerOptionFunc
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
func NewWorkerPool ¶
func NewWorkerPool(database *sql.DB, opts ...PoolOptionFunc) *WorkerPool
func (WorkerPool) RegisterWorker ¶
func (r WorkerPool) RegisterWorker(queueName string, worker Worker, opts ...WorkerOptionFunc)
RegisterWorker registers a worker with the given name.
func (WorkerPool) RegisterWorkerFunc ¶
func (r WorkerPool) RegisterWorkerFunc(queueName string, worker WorkerFunc, opts ...WorkerOptionFunc)
RegisterWorkerFunc registers a worker function with the given queue name.
Click to show internal directories.
Click to hide internal directories.