queue

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 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 Config

type Config struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	Password string `yaml:"password"`
	DB       int    `yaml:"db"`
}

type Handler

type Handler func(job *Job) error

type Job

type Job struct {
	ID         string                 `json:"id"`
	Type       string                 `json:"type"`
	Data       map[string]interface{} `json:"data"`
	CreatedAt  time.Time              `json:"created_at"`
	Attempts   int                    `json:"attempts"`
	MaxRetries int                    `json:"max_retries"`
}

type Queue

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

func New

func New(host string, password string, db int) (*Queue, error)

func (*Queue) Enqueue

func (q *Queue) Enqueue(jobType string, data map[string]interface{}, maxRetries int) (*Job, error)

func (*Queue) IsRunning

func (q *Queue) IsRunning() bool

func (*Queue) RegisterHandler

func (q *Queue) RegisterHandler(jobType string, handler Handler)

func (*Queue) Shutdown

func (q *Queue) Shutdown() error

func (*Queue) Start

func (q *Queue) Start()

func (*Queue) Stop

func (q *Queue) Stop()

Jump to

Keyboard shortcuts

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