Versions in this module Expand all Collapse all v0 v0.1.0 Aug 6, 2026 Changes in this version + var ErrInvalidJobData = errors.New("gopherqueue: invalid job data or metadata") + var ErrJobNotFound = errors.New("gopherqueue: job not found") + var ErrQueueEmpty = errors.New("gopherqueue: queue is empty") + var ErrServerClosed = errors.New("gopherqueue: server is closed") + type Chain struct + func NewChain(middlewares ...MiddlewareFunc) Chain + func (c Chain) Append(middlewares ...MiddlewareFunc) Chain + func (c Chain) Then(final Handler) Handler + type Client struct + func NewClient(opts ...Option) (*Client, error) + func (c *Client) Enqueue(ctx context.Context, job *Job) error + func (c *Client) EnqueueAt(ctx context.Context, job *Job, executeAt time.Time) error + type Config struct + Concurrency int + DefaultTimeout time.Duration + PollInterval time.Duration + QueueName string + Storage Storage + type ErrRateLimited struct + Key string + RetryAfter time.Duration + func IsRateLimited(err error) (*ErrRateLimited, bool) + func (e *ErrRateLimited) Error() string + type Handler interface + ProcessJob func(ctx context.Context, job *Job) error + type HandlerFunc func(ctx context.Context, job *Job) error + func (f HandlerFunc) ProcessJob(ctx context.Context, job *Job) error + type HandlerRegistry struct + func NewHandlerRegistry() *HandlerRegistry + func (r *HandlerRegistry) Execute(ctx context.Context, job *Job) error + func (r *HandlerRegistry) Register(jobType string, handler JobHandler) + type Job struct + CreatedAt int64 + CurrentRetry int + ExecuteAt int64 + ID string + LastError string + MaxRetries int + Payload map[string]any + Queue string + Status JobStatus + TimeoutSeconds int + Type string + UpdatedAt int64 + func NewJob(id, queue, jobType string, payload map[string]any) (*Job, error) + func UnmarshalJob(data string) (*Job, error) + func (j *Job) CalculateNextRetryDelay() time.Duration + func (j *Job) Marshal() (string, error) + type JobExecutor interface + Execute func(ctx context.Context, job *Job) error + type JobHandler func(ctx context.Context, job *Job) error + type JobStatus string + const StatusCompleted + const StatusDeadLetter + const StatusDelayed + const StatusEnqueued + const StatusFailed + const StatusPending + const StatusProcessing + const StatusRateLimited + const StatusRetrying + type MiddlewareFunc func(next Handler) Handler + type Option func(*Config) + func WithConcurrency(n int) Option + func WithPollInterval(d time.Duration) Option + func WithQueue(name string) Option + func WithStorage(s Storage) Option + type Server struct + func NewServer(opts ...Option) *Server + func (s *Server) Register(jobType string, fn func(ctx context.Context, job *Job) error) + func (s *Server) Run(ctx context.Context) error + func (s *Server) Shutdown(ctx context.Context) error + func (s *Server) Use(middlewares ...MiddlewareFunc) + type Storage interface + Ack func(ctx context.Context, job *Job) error + Enqueue func(ctx context.Context, job *Job) error + Fetch func(ctx context.Context, queue string, timeout time.Duration) (*Job, error) + GetDLQCount func(ctx context.Context, queue string) (int64, error) + GetDelayedCount func(ctx context.Context, queue string) (int64, error) + GetPendingCount func(ctx context.Context, queue string) (int64, error) + GetProcessingCount func(ctx context.Context, queue string) (int64, error) + Nack func(ctx context.Context, job *Job, execErr error) error + Reschedule func(ctx context.Context, job *Job, delay time.Duration) error + type WorkerPool struct + func NewWorkerPool(queueName string, numWorkers int, pollInterval time.Duration, store Storage, ...) *WorkerPool + func (wp *WorkerPool) Start(ctx context.Context) + func (wp *WorkerPool) Stop()