Documentation
¶
Overview ¶
Package worker provides a generic worker pool for processing queued jobs. This package offers concurrent job processing with configurable worker counts per queue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config configures the worker pool
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default worker configuration
type JobProcessor ¶
type JobProcessor interface {
Process(ctx context.Context, job interface{}) error
GetJobID(job interface{}) string
GetTimeout(job interface{}) time.Duration
}
JobProcessor defines the interface for processing jobs
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool manages a pool of workers that process jobs from queues
type Queue ¶
type Queue interface {
Dequeue(queueName string, timeout time.Duration) (interface{}, error)
Enqueue(job interface{}) error
MarkProcessing(jobID string, deadline time.Time) error
CompleteJob(jobID string) error
FailJob(jobID string, requeue bool, queueName string, retryCount int) error
}
Queue defines the interface for job queue operations
Click to show internal directories.
Click to hide internal directories.