gokiq

package module
v0.0.0-...-ebbb028 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2014 License: BSD-3-Clause Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	TimestampFormat = "2006-01-02 15:04:05 MST"
)

Variables

View Source
var Client = NewClientConfig()
View Source
var Workers = NewWorkerConfig()

Functions

func Register

func Register(worker interface{}, queue string, retries int)

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:"-"`
}

func (*Job) FromJSON

func (job *Job) FromJSON(data []byte) error

func (*Job) JSON

func (job *Job) JSON() []byte

type JobConfig

type JobConfig struct {
	Name       string
	Queue      string
	MaxRetries int
	At         time.Time
}

type PanicError

type PanicError struct {
	Err   interface{}
	Stack []StackFrame
}

func (*PanicError) Error

func (err *PanicError) Error() string

type QueueConfig

type QueueConfig map[string]int

func (QueueConfig) String

func (q QueueConfig) String() string

type ReportableErrorChecker

type ReportableErrorChecker interface {
	ReportableError(error) bool
}

type StackFrame

type StackFrame struct {
	PC   uintptr
	File string
	Line int
}

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()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL