Documentation ¶
Index ¶
- Constants
- Variables
- func BeforeStart(f func())
- func CancelJob(jid string) error
- func Configure(options map[string]interface{})
- func DuringDrain(f func())
- func Enqueue(queue, class string, args interface{}, opts ...EnqueueOptions) (string, error)
- func JobExists(jid string) (bool, error)
- func Process(queue string, job jobFunc, concurrency int, mids ...Action)
- func Quit()
- func ResetManagers() error
- func Run()
- func ShouldRetry(message *Msg) bool
- func Start()
- func Stats(w http.ResponseWriter, req *http.Request)
- func StatsServer(port int)
- type Acknowledge
- type Action
- type Args
- type CallResult
- type EnqueueData
- type EnqueueOptFunc
- type EnqueueOptions
- type EnqueueParam
- type Fetcher
- type MiddlewareLogging
- type MiddlewareRetry
- type MiddlewareStats
- type Middlewares
- type Msg
Constants ¶
View Source
const (
DEFAULT_MAX_RETRIES = 25
)
View Source
const (
LAYOUT = "2006-01-02 15:04:05 MST"
)
View Source
const (
NanoSecondPrecision = 1000000000.0
)
Variables ¶
View Source
var ( RETRY_KEY = "goretry" SCHEDULED_JOBS_KEY = "schedule" INPROGRESS_JOBS_KEY = "inprogress" ARGV_VALUE_KEY = "argvValue" CANCEL_KEY = "cancel" )
View Source
var Config *config
View Source
var (
ErrJidExists = fmt.Errorf("jid has already exists")
)
View Source
var Logger = logrus.WithField("from", "go-workers")
View Source
var Middleware = NewMiddleware( &MiddlewareLogging{}, &MiddlewareRetry{}, &MiddlewareStats{}, )
Functions ¶
func BeforeStart ¶
func BeforeStart(f func())
func DuringDrain ¶
func DuringDrain(f func())
func Enqueue ¶
func Enqueue(queue, class string, args interface{}, opts ...EnqueueOptions) (string, error)
func ResetManagers ¶
func ResetManagers() error
func ShouldRetry ¶
func StatsServer ¶
func StatsServer(port int)
Types ¶
type Acknowledge ¶
type Acknowledge struct { KeepData bool // contains filtered or unexported fields }
type Action ¶
type Action interface {
Call(queue string, message *Msg, next func() CallResult) CallResult
}
type CallResult ¶
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"` EnqueueParam }
type EnqueueOptFunc ¶
type EnqueueOptFunc func(param *EnqueueParam)
func WithAt ¶
func WithAt(at time.Time) EnqueueOptFunc
func WithIn ¶
func WithIn(in time.Duration) EnqueueOptFunc
func WithJid ¶ added in v0.1.2
func WithJid(jid string) EnqueueOptFunc
func WithMaxRetries ¶
func WithMaxRetries(maxRetries int) EnqueueOptFunc
func WithRetry ¶
func WithRetry() EnqueueOptFunc
func (EnqueueOptFunc) Apply ¶
func (e EnqueueOptFunc) Apply(param *EnqueueParam)
type EnqueueOptions ¶
type EnqueueOptions interface {
Apply(param *EnqueueParam)
}
type EnqueueParam ¶
type Fetcher ¶
type MiddlewareLogging ¶
type MiddlewareLogging struct{}
func (*MiddlewareLogging) Call ¶
func (l *MiddlewareLogging) Call(queue string, message *Msg, next func() CallResult) (result CallResult)
type MiddlewareRetry ¶
type MiddlewareRetry struct{}
func (*MiddlewareRetry) Call ¶
func (r *MiddlewareRetry) Call(queue string, message *Msg, next func() CallResult) (result CallResult)
type MiddlewareStats ¶
type MiddlewareStats struct{}
func (*MiddlewareStats) Call ¶
func (l *MiddlewareStats) Call(queue string, message *Msg, next func() CallResult) (result CallResult)
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)
Click to show internal directories.
Click to hide internal directories.