queue

package
v1.13.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 1 Imported by: 14

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 set the unique signature of the job.
	Signature() string
	// Handle executes the job.
	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 dispatches the task.
	Dispatch() error
	// DispatchSync dispatches the task synchronously.
	DispatchSync() error
	// Delay dispatches the task after the given delay.
	Delay(time time.Time) Task
	// OnConnection sets the connection of the task.
	OnConnection(connection string) Task
	// OnQueue sets the queue of the task.
	OnQueue(queue string) Task
}

type Worker

type Worker interface {
	Run() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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