go-workers: github.com/jrallison/go-workers Index | Files

package workers

import "github.com/jrallison/go-workers"

Index

Package Files

config.go enqueue.go fetcher.go hooks.go job.go manager.go middleware.go middleware_logging.go middleware_retry.go middleware_stats.go msg.go scheduled.go signals_posix.go stats.go worker.go workers.go workers_logger.go

Constants

const (
    DEFAULT_MAX_RETRY = 25
    LAYOUT            = "2006-01-02 15:04:05 MST"
)
const (
    RETRY_KEY          = "goretry"
    SCHEDULED_JOBS_KEY = "schedule"
)
const (
    NanoSecondPrecision = 1000000000.0
)

Variables

var Config *config
var Middleware = NewMiddleware(
    &MiddlewareLogging{},
    &MiddlewareRetry{},
    &MiddlewareStats{},
)

func BeforeStart Uses

func BeforeStart(f func())

func Configure Uses

func Configure(options map[string]string)

func DuringDrain Uses

func DuringDrain(f func())

func Enqueue Uses

func Enqueue(queue, class string, args interface{}) (string, error)

func EnqueueAt Uses

func EnqueueAt(queue, class string, at time.Time, args interface{}) (string, error)

func EnqueueIn Uses

func EnqueueIn(queue, class string, in float64, args interface{}) (string, error)

func EnqueueWithOptions Uses

func EnqueueWithOptions(queue, class string, args interface{}, opts EnqueueOptions) (string, error)

func Process Uses

func Process(queue string, job jobFunc, concurrency int, mids ...Action)

func Quit Uses

func Quit()

func ResetManagers Uses

func ResetManagers() error

func Run Uses

func Run()

func Start Uses

func Start()

func Stats Uses

func Stats(w http.ResponseWriter, req *http.Request)

func StatsServer Uses

func StatsServer(port int)

type Action Uses

type Action interface {
    Call(queue string, message *Msg, next func() bool) bool
}

type Args Uses

type Args struct {
    // contains filtered or unexported fields
}

func (Args) Equals Uses

func (d Args) Equals(other interface{}) bool

func (Args) ToJson Uses

func (d Args) ToJson() string

type EnqueueData Uses

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 Uses

type EnqueueOptions struct {
    RetryCount int     `json:"retry_count,omitempty"`
    Retry      bool    `json:"retry,omitempty"`
    At         float64 `json:"at,omitempty"`
}

type Fetcher Uses

type Fetcher interface {
    Queue() string
    Fetch()
    Acknowledge(*Msg)
    Ready() chan bool
    FinishedWork() chan bool
    Messages() chan *Msg
    Close()
    Closed() bool
}

func NewFetch Uses

func NewFetch(queue string, messages chan *Msg, ready chan bool) Fetcher

type MiddlewareLogging Uses

type MiddlewareLogging struct{}

func (*MiddlewareLogging) Call Uses

func (l *MiddlewareLogging) Call(queue string, message *Msg, next func() bool) (acknowledge bool)

type MiddlewareRetry Uses

type MiddlewareRetry struct{}

func (*MiddlewareRetry) Call Uses

func (r *MiddlewareRetry) Call(queue string, message *Msg, next func() bool) (acknowledge bool)

type MiddlewareStats Uses

type MiddlewareStats struct{}

func (*MiddlewareStats) Call Uses

func (l *MiddlewareStats) Call(queue string, message *Msg, next func() bool) (acknowledge bool)

type Middlewares Uses

type Middlewares struct {
    // contains filtered or unexported fields
}

func NewMiddleware Uses

func NewMiddleware(actions ...Action) *Middlewares

func (*Middlewares) Append Uses

func (m *Middlewares) Append(action Action)

func (*Middlewares) Prepend Uses

func (m *Middlewares) Prepend(action Action)

type Msg Uses

type Msg struct {
    // contains filtered or unexported fields
}

func NewMsg Uses

func NewMsg(content string) (*Msg, error)

func (*Msg) Args Uses

func (m *Msg) Args() *Args

func (Msg) Equals Uses

func (d Msg) Equals(other interface{}) bool

func (*Msg) Jid Uses

func (m *Msg) Jid() string

func (*Msg) OriginalJson Uses

func (m *Msg) OriginalJson() string

func (Msg) ToJson Uses

func (d Msg) ToJson() string

type WorkersLogger Uses

type WorkersLogger interface {
    Println(...interface{})
    Printf(string, ...interface{})
}
var Logger WorkersLogger = log.New(os.Stdout, "workers: ", log.Ldate|log.Lmicroseconds)

Package workers imports 21 packages (graph) and is imported by 26 packages. Updated 2018-01-15. Refresh now. Tools for package owners.