Documentation ¶
Index ¶
- type Job
- type JobStatus
- type Queue
- func (q *Queue) Close() error
- func (q *Queue) GetJobByID(id uint64) (*Job, error)
- func (q *Queue) PushBytes(d []byte) (uint64, error)
- func (q *Queue) PushJob(j *Job) (uint64, error)
- func (q *Queue) RegisterWorker(w Worker)
- func (q *Queue) UpdateJobStatus(id uint64, status JobStatus, message string) error
- type RecoverableWorkerError
- type Worker
- type WorkerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
Job wraps arbitrary data for processing
type JobStatus ¶
type JobStatus int
JobStatus is a enumerated int representing the processing status of a Job
type Queue ¶
type Queue struct { ID string // contains filtered or unexported fields }
Queue represents a queue
func (*Queue) Close ¶
Close attempts to gracefull shutdown all workers in a queue and shutdown the db connection
func (*Queue) GetJobByID ¶
GetJobByID returns a pointer to a Job based on the primary key identifier id
func (*Queue) PushBytes ¶
PushBytes wraps arbitrary binary data in a job and pushes it onto the queue
func (*Queue) PushJob ¶
PushJob pushes a job to the queue and notifies workers Job.ID is always overwritten
func (*Queue) RegisterWorker ¶
RegisterWorker registers a Worker to handle queued Jobs
type RecoverableWorkerError ¶
type RecoverableWorkerError struct {
// contains filtered or unexported fields
}
RecoverableWorkerError defines an error that a worker DoWork func can return that indicates the message should be retried
func NewRecoverableWorkerError ¶
func NewRecoverableWorkerError(message string) RecoverableWorkerError
NewRecoverableWorkerError creates a new RecoverableWorkerError
func (RecoverableWorkerError) Error ¶
func (e RecoverableWorkerError) Error() string
type WorkerConfig ¶
type WorkerConfig struct { //PollingRate is the number of milliseconds to sleep after checking the queue for a job PollingRate uint8 }
WorkerConfig configures a worker