Documentation
¶
Index ¶
Constants ¶
View Source
const ( RRID string = "rr_id" RRJob string = "rr_job" RRHeaders string = "rr_headers" RRPipeline string = "rr_pipeline" RRDelay string = "rr_delay" RRPriority string = "rr_priority" RRAutoAck string = "rr_auto_ack" )
constant keys to pack/unpack messages from different drivers
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 {
Name() string
ConsumerFromConfig(configKey string, queue priorityqueue.Queue) (Consumer, error)
ConsumerFromPipeline(pipe Pipeline, queue priorityqueue.Queue) (Consumer, error)
}
Constructor constructs Consumer interface. Endure abstraction.
type Consumer ¶
type Consumer interface {
Push(ctx context.Context, job Job) error
Register(ctx context.Context, pipeline Pipeline) error
Run(ctx context.Context, 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 Pipeline ¶
type Pipeline interface {
// With pipeline value
With(name string, value any)
// Name returns pipeline name.
Name() string
// Driver associated with the pipeline.
Driver() string
// Has checks if value presented in pipeline.
Has(name string) bool
// String must return option value as string or return default value.
String(name string, d string) string
// Int must return option value as string or return default value.
Int(name string, d int) int
// Bool must return option value as bool or return default value.
Bool(name string, d bool) bool
// Map must return nested map value or empty config.
// Here might be sqs attributes or tags for example
Map(name string, out map[string]string) error
// Priority returns default pipeline priority
Priority() int64
// Get used to get the data associated with the key
Get(key string) any
}
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
// New in 2.10.5, pipeline priority
Priority uint64
}
State represents job's state
Click to show internal directories.
Click to hide internal directories.