Documentation
¶
Index ¶
- Constants
- Variables
- func BeforeStart(f func())
- func Configure(options Options)
- func DuringDrain(f func())
- func Enqueue(queue, class string, args interface{}) (string, error)
- func EnqueueAt(queue, class string, at time.Time, args interface{}) (string, error)
- func EnqueueIn(queue, class string, in float64, args interface{}) (string, error)
- func EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
- func GetConnectionPool(options Options) *redis.Pool
- func Process(queue string, job jobFunc, concurrency int, mids ...Action)
- func Quit()
- func ResetManagers() error
- func Run()
- func SetLogger(l WorkersLogger)
- func Start()
- func Stats(w http.ResponseWriter, req *http.Request)
- func StatsServer(port int)
- type Action
- type Args
- type EnqueueData
- type EnqueueOptions
- type Fetcher
- type MiddlewareLogging
- type MiddlewareRetry
- type MiddlewareStats
- type Middlewares
- type Msg
- type Options
- type RetryOptions
- type WorkerConfig
- type WorkerStats
- type WorkersLogger
Constants ¶
View Source
const ( DEFAULT_MAX_RETRY = 25 LAYOUT = "2006-01-02 15:04:05 MST" )
View Source
const ( RETRY_KEY = "goretry" SCHEDULED_JOBS_KEY = "schedule" )
View Source
const (
NanoSecondPrecision = 1000000000.0
)
Variables ¶
View Source
var Logger = initLogger()
Logger is the default logger
View Source
var Middleware = NewMiddleware( &MiddlewareLogging{}, &MiddlewareRetry{}, &MiddlewareStats{}, )
Functions ¶
func BeforeStart ¶
func BeforeStart(f func())
func DuringDrain ¶
func DuringDrain(f func())
func EnqueueWithOptions ¶
func EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)
func GetConnectionPool ¶
func ResetManagers ¶
func ResetManagers() error
func SetLogger ¶ added in v1.0.0
func SetLogger(l WorkersLogger)
SetLogger rewrites the default logger
func Stats ¶
func Stats(w http.ResponseWriter, req *http.Request)
Stats writes stats on response writer
func StatsServer ¶
func StatsServer(port int)
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 EnqueueOptions struct { RetryCount int `json:"retry_count,omitempty"` Retry bool `json:"retry,omitempty"` RetryMax int `json:"retry_max,omitempty"` At float64 `json:"at,omitempty"` RetryOptions RetryOptions `json:"retry_options,omitempty"` ConnectionOptions Options `json:"connection_options,omitempty"` }
type Fetcher ¶
type MiddlewareLogging ¶
type MiddlewareLogging struct{}
type MiddlewareRetry ¶
type MiddlewareRetry struct{}
type MiddlewareStats ¶
type MiddlewareStats struct{}
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) Prepend ¶
func (m *Middlewares) Prepend(action Action)
type RetryOptions ¶
type WorkerConfig ¶ added in v1.2.1
type WorkerConfig struct { Namespace string PoolInterval int Pool *redis.Pool Fetch func(queue string) Fetcher // contains filtered or unexported fields }
var Config *WorkerConfig
type WorkerStats ¶
type WorkerStats struct { Processed int `json:"processed"` Failed int `json:"failed"` Enqueued map[string]string `json:"enqueued"` Retries int64 `json:"retries"` }
WorkerStats holds workers stats
type WorkersLogger ¶
type WorkersLogger interface { Fatal(format ...interface{}) Fatalf(format string, args ...interface{}) Fatalln(args ...interface{}) Debug(args ...interface{}) Debugf(format string, args ...interface{}) Debugln(args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Errorln(args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Infoln(args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Warnln(args ...interface{}) }
WorkersLogger represents the log interface
Click to show internal directories.
Click to hide internal directories.