Documentation
¶
Index ¶
- Constants
- func Configure(cfg ConfigureOpts) (configObj *config, err error)
- func Stats(workers *Workers, w http.ResponseWriter, req *http.Request)
- func StatsServer(workers *Workers, port int)
- type Action
- type Args
- type ConfigureOpts
- type EnqueueData
- type EnqueueOptions
- type Fetcher
- type GoWorkers
- type MiddlewareLogging
- type MiddlewareRetry
- type MiddlewareStats
- type Middlewares
- type Msg
- type QueueDepth
- type QueueStats
- type Workers
- func (w *Workers) BeforeStart(f func())
- func (w *Workers) DuringDrain(f func())
- func (w *Workers) Enqueue(queue, class string, args interface{}) (string, error)
- func (w *Workers) EnqueueAt(queue, class string, at time.Time, args interface{}) (string, error)
- func (w *Workers) EnqueueIn(queue, class string, in float64, args interface{}) (string, error)
- func (w *Workers) EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
- func (w *Workers) Namespace() string
- func (w *Workers) NamespacedKey(keys ...string) string
- func (w *Workers) Ping() error
- func (w *Workers) Process(queue string, job jobFunc, concurrency int, mids ...Action)
- func (w *Workers) QueueStats() (queueStats *QueueStats, err error)
- func (w *Workers) Quit()
- func (w *Workers) RedisPool() *redis.Pool
- func (w *Workers) ResetManagers() error
- func (w *Workers) Run()
- func (w *Workers) Start()
- func (w *Workers) TrimKeyNamespace(key string) string
- func (w *Workers) WaitForExit()
- type WorkersLogger
Constants ¶
View Source
const ( DEFAULT_MAX_RETRY = 25 LAYOUT = "2006-01-02 15:04:05 MST" )
View Source
const (
NanoSecondPrecision = 1000000000.0
)
Variables ¶
This section is empty.
Functions ¶
func Configure ¶
func Configure(cfg ConfigureOpts) (configObj *config, err error)
func StatsServer ¶
Types ¶
type ConfigureOpts ¶
type ConfigureOpts struct {
// RedisURL is a redis schemed URL as understood by redigo:
// https://godoc.org/github.com/garyburd/redigo/redis#DialURL
RedisURL string
// ProcessID uniquely identifies this process. Used for uncoordinated reliable processing of messages.
ProcessID string
// MaxIdle is the maximum number of idle connections to keep in the redis connection pool.
MaxIdle int
// PoolSize is the maximum number of connections allowed by the redis conneciton pool.
PoolSize int
// PollInterval is how often we should poll for scheduled jobs.
PollInterval int
// Namespace is the namespace to use for redis keys.
Namespace string
RedisPool *redis.Pool
}
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 GoWorkers ¶
type GoWorkers interface {
Run()
Start()
Quit()
WaitForExit()
ResetManagers() error
Process(queue string, job jobFunc, concurrency int, mids ...Action)
Enqueue(queue, class string, args interface{}) (string, error)
EnqueueIn(queue, class string, in float64, args interface{}) (string, error)
EnqueueAt(queue, class string, at time.Time, args interface{}) (string, error)
EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
BeforeStart(f func())
DuringDrain(f func())
Ping() error
QueueStats() (queueStats *QueueStats, err error)
Namespace() string
NamespacedKey(keys ...string) string
TrimKeyNamespace(key string) string
}
type MiddlewareLogging ¶
type MiddlewareLogging struct{}
type MiddlewareRetry ¶
type MiddlewareRetry struct {
// contains filtered or unexported fields
}
type MiddlewareStats ¶
type MiddlewareStats struct {
// contains filtered or unexported fields
}
type Middlewares ¶
type Middlewares struct {
// contains filtered or unexported fields
}
func NewMiddleware ¶
func NewMiddleware(actions ...Action) *Middlewares
func (*Middlewares) Append ¶
func (m *Middlewares) Append(action Action)
func (*Middlewares) AppendToCopy ¶
func (m *Middlewares) AppendToCopy(mids []Action) *Middlewares
func (*Middlewares) Equals ¶
func (m *Middlewares) Equals(other *Middlewares) bool
func (*Middlewares) Prepend ¶
func (m *Middlewares) Prepend(action Action)
type QueueDepth ¶
type QueueStats ¶
type QueueStats struct {
Queues []*QueueDepth
RetryDepth int
}
type Workers ¶
type Workers struct {
// contains filtered or unexported fields
}
func NewWorkers ¶
func NewWorkers(config *config) *Workers
func (*Workers) BeforeStart ¶
func (w *Workers) BeforeStart(f func())
func (*Workers) DuringDrain ¶
func (w *Workers) DuringDrain(f func())
func (*Workers) EnqueueWithOptions ¶
func (w *Workers) EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
func (*Workers) NamespacedKey ¶
func (*Workers) QueueStats ¶
func (w *Workers) QueueStats() (queueStats *QueueStats, err error)
func (*Workers) ResetManagers ¶
func (*Workers) TrimKeyNamespace ¶
func (*Workers) WaitForExit ¶
func (w *Workers) WaitForExit()
type WorkersLogger ¶
type WorkersLogger interface {
Println(...interface{})
Printf(string, ...interface{})
}
var Logger WorkersLogger = log.New(os.Stdout, "workers: ", log.Ldate|log.Lmicroseconds)
Click to show internal directories.
Click to hide internal directories.

