Documentation
¶
Index ¶
Constants ¶
View Source
const ( // Jobs will be reserved for 30 minutes by default. // You can customize this per-job with the reserve_for attribute // in the job payload. DefaultTimeout = 30 * 60 // Save dead jobs for 180 days, after that they will be purged DeadTTL = 180 * 24 * time.Hour )
Variables ¶
View Source
var (
JobReservationExpired = &FailPayload{
ErrorType: "ReservationExpired",
ErrorMessage: "Faktory job reservation expired",
}
)
Functions ¶
Types ¶
type FailPayload ¶
type Manager ¶
type Manager interface {
Push(job *client.Job) error
// Dispatch operations:
//
// - Basic dequeue
// - Connection sends FETCH q1, q2
// - Job moved from Queue into Working
// - Scheduled
// - Job Pushed into Queue
// - Job moved from Queue into Working
// - Failure
// - Job Pushed into Retries
// - Push
// - Job Pushed into Queue
// - Ack
// - Job removed from Working
//
// How are jobs passed to waiting workers?
//
// Socket sends "FETCH q1, q2, q3"
// Connection pops each queue:
// store.GetQueue("q1").Pop()
// and returns if it gets any non-nil data.
//
// If all nil, the connection registers itself, blocking for a job.
Fetch(ctx context.Context, wid string, queues ...string) (*client.Job, error)
Acknowledge(jid string) (*client.Job, error)
Fail(fail *FailPayload) error
WorkingCount() int
ReapExpiredJobs(timestamp string) (int, error)
// Purge deletes all dead jobs
Purge() (int64, error)
// EnqueueScheduledJobs enqueues scheduled jobs
EnqueueScheduledJobs() (int64, error)
// RetryJobs enqueues failed jobs
RetryJobs() (int64, error)
BusyCount(wid string) int
AddMiddleware(fntype string, fn MiddlewareFunc)
}
func NewManager ¶
type MiddlewareChain ¶
type MiddlewareChain []MiddlewareFunc
Click to show internal directories.
Click to hide internal directories.