queue

package
v0.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsynqQueue

type AsynqQueue struct {
	// contains filtered or unexported fields
}

AsynqQueue implements QueueService using hibiken/asynq (Redis-based).

func NewAsynqQueue

func NewAsynqQueue(cfg *config.QueueConfig) (*AsynqQueue, error)

NewAsynqQueue constructs an asynq-backed queue from the given config.

func (*AsynqQueue) Enqueue

func (q *AsynqQueue) Enqueue(ctx context.Context, taskName string, payload []byte, opts ...asynq.Option) (*asynq.TaskInfo, error)

Enqueue pushes a task onto the queue.

func (*AsynqQueue) RegisterHandler

func (q *AsynqQueue) RegisterHandler(pattern string, handler asynq.Handler)

RegisterHandler registers a task handler under the given pattern.

func (*AsynqQueue) Shutdown

func (q *AsynqQueue) Shutdown()

Shutdown gracefully stops the server and closes the client.

func (*AsynqQueue) Start

func (q *AsynqQueue) Start() error

Start begins processing tasks. Blocks until Shutdown is called.

type QueueService

type QueueService interface {
	Enqueue(ctx context.Context, taskName string, payload []byte, opts ...asynq.Option) (*asynq.TaskInfo, error)
	RegisterHandler(pattern string, handler asynq.Handler)
	Start() error
	Shutdown()
}

QueueService is the interface for async task processing.

func NewQueueService

func NewQueueService(cfg *config.QueueConfig, logger *slog.Logger) (QueueService, error)

NewQueueService creates the task queue from config. Returns nil if disabled.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL