Help us shape the future of Go! Take the 2026 Go Developer Survey

queue

package
v1.20.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SyncDriverName = "sync"
)

Functions

This section is empty.

Types

type Application

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

func NewApplication

func NewApplication(config queue.Config, cache cache.Cache, db db.DB, job queue.JobStorer, json foundation.Json, log log.Log) *Application

func (*Application) Chain

func (r *Application) Chain(jobs []queue.ChainJob) queue.PendingJob

func (*Application) Connection

func (r *Application) Connection(name string) (queue.Driver, error)

func (*Application) Failer

func (r *Application) Failer() queue.Failer

func (*Application) GetJob

func (r *Application) GetJob(signature string) (queue.Job, error)

func (*Application) GetJobs

func (r *Application) GetJobs() []queue.Job

func (*Application) Job

func (r *Application) Job(job queue.Job, args ...[]queue.Arg) queue.PendingJob

func (*Application) JobStorer

func (r *Application) JobStorer() queue.JobStorer

func (*Application) Register

func (r *Application) Register(jobs []queue.Job)

func (*Application) Worker

func (r *Application) Worker(payloads ...queue.Args) queue.Worker

type Config

type Config struct {
	contractsconfig.Config
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig(config contractsconfig.Config) *Config

func (*Config) Debug

func (r *Config) Debug() bool

func (*Config) DefaultConcurrent

func (r *Config) DefaultConcurrent() int

func (*Config) DefaultConnection

func (r *Config) DefaultConnection() string

func (*Config) DefaultQueue

func (r *Config) DefaultQueue() string

func (*Config) Driver

func (r *Config) Driver(connection string) string

func (*Config) FailedDatabase

func (r *Config) FailedDatabase() string

func (*Config) FailedTable

func (r *Config) FailedTable() string

func (*Config) Timeout

func (r *Config) Timeout(connection string) time.Duration

Timeout resolves the blocking receive timeout for the given connection from `queue.connections.<connection>.timeout`, falling back to the default when the value is missing, non-positive or unparsable.

func (*Config) Via

func (r *Config) Via(connection string) any

type Database

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

func NewDatabase

func NewDatabase(
	config contractsqueue.Config,
	cache contractscache.Cache,
	db contractsdb.DB,
	jobStorer contractsqueue.JobStorer,
	json contractsfoundation.Json,
	connection string) (*Database, error)

func (*Database) Driver

func (r *Database) Driver() string

func (*Database) Pop

func (r *Database) Pop(queue string) (contractsqueue.ReservedJob, error)

func (*Database) Push

func (r *Database) Push(task contractsqueue.Task, queue string) error

type DatabaseReservedJob

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

func NewDatabaseReservedJob

func NewDatabaseReservedJob(job *models.Job, db contractsdb.DB, jobStorer contractsqueue.JobStorer, json contractsfoundation.Json, jobsTable string) (*DatabaseReservedJob, error)

func (*DatabaseReservedJob) Attempts

func (r *DatabaseReservedJob) Attempts() int

Attempts returns the current attempt count of the job row.

func (*DatabaseReservedJob) Delete

func (r *DatabaseReservedJob) Delete() error

func (*DatabaseReservedJob) Release

func (r *DatabaseReservedJob) Release(delay time.Duration) error

Release clears the reservation and makes the job available again after the delay. Attempts is preserved so the next pop increments it (attempt N+1). A single UPDATE keeps the row id stable, unlike Laravel's delete+re-insert.

func (*DatabaseReservedJob) Task

type DriverCreator

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

func (*DriverCreator) Create

func (r *DriverCreator) Create(connection string) (contractsqueue.Driver, error)

type FailedJob

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

func NewFailedJob

func NewFailedJob(failedJob models.FailedJob, query db.Query, queue contractsqueue.Queue, json foundation.Json) *FailedJob

func (*FailedJob) Connection

func (r *FailedJob) Connection() string

func (*FailedJob) FailedAt

func (r *FailedJob) FailedAt() *carbon.DateTime

func (*FailedJob) Queue

func (r *FailedJob) Queue() string

func (*FailedJob) Retry

func (r *FailedJob) Retry() error

func (*FailedJob) Signature

func (r *FailedJob) Signature() string

func (*FailedJob) UUID

func (r *FailedJob) UUID() string

type Failer

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

func NewFailer

func NewFailer(config config.Config, db db.DB, queue contractsqueue.Queue, json foundation.Json) *Failer

func (*Failer) All

func (r *Failer) All() ([]contractsqueue.FailedJob, error)

func (*Failer) Get

func (r *Failer) Get(connection, queue string, uuids []string) ([]contractsqueue.FailedJob, error)

type JobStorer

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

func NewJobStorer

func NewJobStorer() *JobStorer

func (*JobStorer) All

func (r *JobStorer) All() []contractsqueue.Job

All gets all registered jobs

func (*JobStorer) Call

func (r *JobStorer) Call(signature string, args []any) error

Call calls a registered job using its signature

func (*JobStorer) Get

func (r *JobStorer) Get(signature string) (contractsqueue.Job, error)

Get gets a registered job using its signature

func (*JobStorer) Register

func (r *JobStorer) Register(jobs []contractsqueue.Job)

Register registers jobs to the job manager

type PendingJob

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

func (*PendingJob) Delay

func (r *PendingJob) Delay(delay time.Time) contractsqueue.PendingJob

Delay sets a delay time for the task

func (*PendingJob) Dispatch

func (r *PendingJob) Dispatch() error

Dispatch dispatches the task

func (*PendingJob) DispatchSync

func (r *PendingJob) DispatchSync() error

DispatchSync dispatches the task synchronously

func (*PendingJob) OnConnection

func (r *PendingJob) OnConnection(connection string) contractsqueue.PendingJob

OnConnection sets the connection name

func (*PendingJob) OnQueue

func (r *PendingJob) OnQueue(queue string) contractsqueue.PendingJob

OnQueue sets the single queue to which the task is dispatched.

type QueueRunner

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

func NewQueueRunner

func NewQueueRunner(config config.Config, queue contractsqueue.Queue) *QueueRunner

func (*QueueRunner) Run

func (r *QueueRunner) Run() error

func (*QueueRunner) ShouldRun

func (r *QueueRunner) ShouldRun() bool

func (*QueueRunner) Shutdown

func (r *QueueRunner) Shutdown() error

func (*QueueRunner) Signature

func (r *QueueRunner) Signature() string

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (r *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (r *ServiceProvider) Register(app foundation.Application)

func (*ServiceProvider) Relationship

func (r *ServiceProvider) Relationship() binding.Relationship

func (*ServiceProvider) Runners

type Sync

type Sync struct {
}

func NewSync

func NewSync() *Sync

func (*Sync) Driver

func (r *Sync) Driver() string

func (*Sync) Pop

func (r *Sync) Pop(_ string) (queue.ReservedJob, error)

func (*Sync) Push

func (r *Sync) Push(task queue.Task, _ string) error

type Worker

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

func NewWorker

func NewWorker(config queue.Config, cache cache.Cache, db db.DB, job queue.JobStorer, json foundation.Json, log log.Log, connection, queue string, concurrent, tries int) (*Worker, error)

func (*Worker) Run

func (r *Worker) Run() error

func (*Worker) Shutdown

func (r *Worker) Shutdown() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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