Documentation
¶
Index ¶
- Constants
- Variables
- func StartAPIServer(port int)
- func StopAPIServer()
- type Args
- type EnqueueData
- type EnqueueOptions
- type Fetcher
- type JobFunc
- type JobStatus
- type Manager
- func (m *Manager) AddBeforeStartHooks(hooks ...func())
- func (m *Manager) AddDuringDrainHooks(hooks ...func())
- func (m *Manager) AddWorker(queue string, concurrency int, job JobFunc, mids ...MiddlewareFunc)
- func (m *Manager) GetRedisClient() *redis.Client
- func (m *Manager) GetRetries(page uint64, page_size int64, match string) (Retries, error)
- func (m *Manager) GetStats() (Stats, error)
- func (m *Manager) Producer() *Producer
- func (m *Manager) Run()
- func (m *Manager) Stop()
- type MiddlewareFunc
- type Middlewares
- type Msg
- type Options
- type Producer
- func (p *Producer) Enqueue(queue, class string, args interface{}) (string, error)
- func (p *Producer) EnqueueAt(queue, class string, at time.Time, args interface{}) (string, error)
- func (p *Producer) EnqueueIn(queue, class string, in float64, args interface{}) (string, error)
- func (p *Producer) EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
- func (p *Producer) GetRedisClient() *redis.Client
- type Retries
- type RetryJobStats
- type Stats
Constants ¶
const ( // DefaultRetryMax is default for max number of retries for a job DefaultRetryMax = 25 // RetryTimeFormat is default for retry time format RetryTimeFormat = "2006-01-02 15:04:05 MST" )
const (
NanoSecondPrecision = 1000000000.0
)
Variables ¶
var Logger = log.New(os.Stdout, "workers: ", log.Ldate|log.Lmicroseconds)
Logger is a stdout logger for workers
Functions ¶
func StartAPIServer ¶ added in v0.9.0
func StartAPIServer(port int)
func StopAPIServer ¶ added in v0.9.2
func StopAPIServer()
Types ¶
type EnqueueData ¶
type EnqueueData struct {
Queue string `json:"queue,omitempty"`
Class string `json:"class"`
Args interface{} `json:"args"`
Jid string `json:"jid"`
EnqueuedAt float64 `json:"enqueued_at"`
EnqueueOptions
}
type EnqueueOptions ¶
type Fetcher ¶
type Fetcher interface {
Queue() string
Fetch()
Acknowledge(*Msg)
Ready() chan bool
Messages() chan *Msg
Close()
Closed() bool
}
Fetcher is an interface for managing work messages
type JobFunc ¶
func LogMiddleware ¶
LogMiddleware is the default logging middleware
func NopMiddleware ¶
NopMiddleware does nothing
func RetryMiddleware ¶
RetryMiddleware middleware that allows retries for jobs failures
type Manager ¶ added in v0.8.0
type Manager struct {
// contains filtered or unexported fields
}
Manager coordinates work, workers, and signaling needed for job processing
func NewManager ¶ added in v0.8.0
NewManager creates a new manager with provide options
func NewManagerWithRedisClient ¶ added in v0.8.3
NewManagerWithRedisClient creates a new manager with provide options and pre-configured Redis client
func (*Manager) AddBeforeStartHooks ¶ added in v0.8.0
func (m *Manager) AddBeforeStartHooks(hooks ...func())
AddBeforeStartHooks adds functions to be executed before the manager starts
func (*Manager) AddDuringDrainHooks ¶ added in v0.8.0
func (m *Manager) AddDuringDrainHooks(hooks ...func())
AddDuringDrainHooks adds function to be execute during a drain operation
func (*Manager) AddWorker ¶ added in v0.8.0
func (m *Manager) AddWorker(queue string, concurrency int, job JobFunc, mids ...MiddlewareFunc)
AddWorker adds a new job processing worker
func (*Manager) GetRedisClient ¶ added in v0.8.1
GetRedisClient returns the Redis client used by the manager
func (*Manager) GetRetries ¶ added in v0.9.0
GetRetries returns the set of retry jobs for the manager
func (*Manager) Producer ¶ added in v0.8.0
Producer creates a new work producer with configuration identical to the manager
type Middlewares ¶
type Middlewares []MiddlewareFunc
func DefaultMiddlewares ¶
func DefaultMiddlewares() Middlewares
func NewMiddlewares ¶
func NewMiddlewares(mids ...MiddlewareFunc) Middlewares
func (Middlewares) Append ¶
func (m Middlewares) Append(mid MiddlewareFunc) Middlewares
func (Middlewares) Prepend ¶
func (m Middlewares) Prepend(mid MiddlewareFunc) Middlewares
type Options ¶
type Options struct {
ProcessID string
Namespace string
PollInterval int
Database int
Password string
PoolSize int
// Provide one of ServerAddr or (SentinelAddrs + RedisMasterName)
ServerAddr string
SentinelAddrs string
RedisMasterName string
RedisTLSConfig *tls.Config
// Optional display name used when displaying manager stats
ManagerDisplayName string
// contains filtered or unexported fields
}
Options contains the set of configuration options for a manager and/or producer
type Producer ¶ added in v0.8.0
type Producer struct {
// contains filtered or unexported fields
}
func NewProducer ¶ added in v0.8.0
func NewProducerWithRedisClient ¶ added in v0.8.3
func (*Producer) EnqueueWithOptions ¶ added in v0.8.0
func (p *Producer) EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
func (*Producer) GetRedisClient ¶ added in v0.8.1
type Retries ¶ added in v0.9.0
type Retries struct {
TotalRetryCount int64 `json:"total_retry_count"`
RetryJobs []RetryJobStats `json:"retry_jobs"`
}

