Documentation ¶
Index ¶
Constants ¶
const (
DefaultHandlerTimeout = 30 * time.Second
)
Variables ¶
Functions ¶
func DefaultRecoveryCallback ¶
DefaultRecoveryCallback is the function that gets called by default when handlers panic
Types ¶
type Handler ¶
type Handler struct { Handle Func Concurrency int JobTimeout time.Duration QueueCapacity int64 Queue string RecoverCallback RecoveryCallback // function called when fatal handler errors occur }
Handler handles jobs on a queue
func New ¶
New creates new queue handlers for specific queues. This function is to be usued to create new Handlers for non-periodic jobs (most jobs). Use NewPeriodic to initialize handlers for periodic jobs.
func NewPeriodic ¶
NewPeriodic creates new queue handlers for periodic jobs. Use New to initialize handlers for non-periodic jobs.
func (*Handler) WithOptions ¶
WithOptions sets one or more options on handler
type Option ¶
type Option func(w *Handler)
Option is function that sets optional configuration for Handlers
func Concurrency ¶
Concurrency configures Neoq handlers to process jobs concurrently the default concurrency is the number of (v)CPUs on the machine running Neoq
func JobTimeout ¶
JobTimeout configures handlers with a time deadline for every executed job The timeout is the amount of time that can be spent executing the handler's Func when a timeout is exceeded, the job fails and enters its retry phase
func MaxQueueCapacity ¶
MaxQueueCapacity configures Handlers to enforce a maximum capacity on the queues that it handles queues that have reached capacity cause Enqueue() to block until the queue is below capacity
func RecoverCallback ¶
func RecoverCallback(f RecoveryCallback) Option
RecoverCallback configures the handler with a recovery function to be called when fatal errors occur in Handlers