Documentation
¶
Index ¶
- Constants
- Variables
- func Register(worker interface{}, queue string, retries int)
- type ClientConfig
- func (c *ClientConfig) QueueJob(worker interface{}) error
- func (c *ClientConfig) QueueJobConfig(worker interface{}, config JobConfig) error
- func (c *ClientConfig) Register(worker interface{}, queue string, retries int)
- func (c *ClientConfig) RegisterName(name string, worker interface{}, queue string, retries int)
- type Job
- type JobConfig
- type PanicError
- type QueueConfig
- type ReportableErrorChecker
- type StackFrame
- type UnknownWorkerError
- type WorkerConfig
Constants ¶
View Source
const (
TimestampFormat = "2006-01-02 15:04:05 MST"
)
Variables ¶
View Source
var Client = NewClientConfig()
View Source
var Workers = NewWorkerConfig()
Functions ¶
Types ¶
type ClientConfig ¶
type ClientConfig struct {
RedisPool *redis.Pool
RedisNamespace string
TestMode bool
TestQueue []interface{}
// contains filtered or unexported fields
}
func NewClientConfig ¶
func NewClientConfig() *ClientConfig
func (*ClientConfig) QueueJob ¶
func (c *ClientConfig) QueueJob(worker interface{}) error
func (*ClientConfig) QueueJobConfig ¶
func (c *ClientConfig) QueueJobConfig(worker interface{}, config JobConfig) error
func (*ClientConfig) Register ¶
func (c *ClientConfig) Register(worker interface{}, queue string, retries int)
func (*ClientConfig) RegisterName ¶
func (c *ClientConfig) RegisterName(name string, worker interface{}, queue string, retries int)
type Job ¶
type Job struct {
Type string `json:"class"`
Args *json.RawMessage `json:"args"`
Queue string `json:"queue,omitempty"`
ID string `json:"jid"`
Retry interface{} `json:"retry"` // can be int (number of retries) or bool (true means default)
MaxRetries int `json:"-"`
RetryCount int `json:"retry_count"`
ErrorMessage string `json:"error_message,omitempty"`
ErrorType string `json:"error_class,omitempty"`
RetriedAt string `json:"retried_at,omitempty"`
FailedAt string `json:"failed_at,omitempty"`
StartTime time.Time `json:"-"`
}
type PanicError ¶
type PanicError struct {
Err interface{}
Stack []StackFrame
}
func (*PanicError) Error ¶
func (err *PanicError) Error() string
type QueueConfig ¶
func (QueueConfig) String ¶
func (q QueueConfig) String() string
type ReportableErrorChecker ¶
type StackFrame ¶
type UnknownWorkerError ¶
type UnknownWorkerError struct{ Type string }
func (UnknownWorkerError) Error ¶
func (e UnknownWorkerError) Error() string
type WorkerConfig ¶
type WorkerConfig struct {
inject.Injector
RedisPool *redis.Pool
RedisNamespace string
Queues QueueConfig
WorkerCount int
PollInterval time.Duration
StopTimeout time.Duration
ReportError func(error, *Job)
sync.RWMutex // R is locked by Run() and scheduler(), W is locked by quitHandler() when it receives a signal
// contains filtered or unexported fields
}
func NewWorkerConfig ¶
func NewWorkerConfig() *WorkerConfig
func (*WorkerConfig) Register ¶
func (w *WorkerConfig) Register(worker interface{})
func (*WorkerConfig) RegisterName ¶
func (w *WorkerConfig) RegisterName(name string, worker interface{})
func (*WorkerConfig) Run ¶
func (w *WorkerConfig) Run()
Click to show internal directories.
Click to hide internal directories.