jobs

package
v2.6.6 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Acknowledger

type Acknowledger interface {
	// Ack - acknowledge the Item after processing
	Ack() error

	// Nack - discard the Item
	Nack() error

	// Requeue - put the message back to the queue with the optional delay
	Requeue(headers map[string][]string, delay int64) error

	// Respond to the queue
	Respond(payload []byte, queue string) error
}

Acknowledger provides queue specific item management

type Constructor

type Constructor interface {
	ConsumerFromConfig(configKey string, queue priorityqueue.Queue) (Consumer, error)
	ConsumerFromPipeline(pipe *pipeline.Pipeline, queue priorityqueue.Queue) (Consumer, error)
}

Constructor constructs Consumer interface. Endure abstraction.

type Consumer

type Consumer interface {
	Push(ctx context.Context, job *job.Job) error
	Register(ctx context.Context, pipeline *pipeline.Pipeline) error
	Run(ctx context.Context, pipeline *pipeline.Pipeline) error
	Stop(ctx context.Context) error

	Pause(ctx context.Context, pipeline string)
	Resume(ctx context.Context, pipeline string)

	// State provide information about driver state
	State(ctx context.Context) (*State, error)
}

Consumer represents a single jobs driver interface

type State

type State struct {
	// Pipeline name
	Pipeline string
	// Driver name
	Driver string
	// Queue name (tube for the beanstalk)
	Queue string
	// Active jobs which are consumed from the driver but not handled by the PHP worker yet
	Active int64
	// Delayed jobs
	Delayed int64
	// Reserved jobs which are in the driver but not consumed yet
	Reserved int64
	// Status - 1 Ready, 0 - Paused
	Ready bool
}

State represents job's state

Jump to

Keyboard shortcuts

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