queue

package
v1.1.21 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Type  string
	Value any
}

type Args

type Args struct {
	// Specify connection
	Connection string
	// Specify queue
	Queue string
	// Concurrent num
	Concurrent int
}

type Job

type Job interface {
	Signature() string
	Handle(args ...any) error
}

type Jobs

type Jobs struct {
	Job  Job
	Args []Arg
}

type Queue

type Queue interface {
	Worker(args *Args) Worker
	// Register Register jobs
	Register(jobs []Job)
	// GetJobs Get all jobs
	GetJobs() []Job
	// Job Add a job to queue
	Job(job Job, args []Arg) Task
	// Chain Creates a chain of jobs to be processed one by one, passing
	Chain(jobs []Jobs) Task
}

type Task

type Task interface {
	Dispatch() error
	DispatchSync() error
	OnConnection(connection string) Task
	OnQueue(queue string) Task
}

type Worker

type Worker interface {
	Run() error
}

Jump to

Keyboard shortcuts

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