job

package
v0.0.0-...-6dbf283 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(queue string, worker Worker)

==============================================================================

func Run

func Run(file string, store Store, logger logging.Logger) error

Types

type Configuration

type Configuration struct {
	Workers  int            `toml:"workers"`
	TimeoutI int            `toml:"timeout"`
	QueuesM  map[string]int `toml:"queues"`
}

func (*Configuration) Queues

func (p *Configuration) Queues() []string

func (*Configuration) Timeout

func (p *Configuration) Timeout() time.Duration

type Message

type Message struct {
	Id      string    `json:"id"`
	Title   string    `json:"title"`
	Body    []byte    `json:"body"`
	Created time.Time `json:"created"`
}

func NewMessage

func NewMessage(args ...interface{}) (*Message, error)

func (*Message) Parse

func (p *Message) Parse(args ...interface{}) error

func (*Message) String

func (p *Message) String() string

type RedisStore

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

func (*RedisStore) Done

func (p *RedisStore) Done(queue string, msg *Message, err error)

func (*RedisStore) Pop

func (p *RedisStore) Pop(timeout time.Duration, queues ...string) (string, *Message, error)

func (*RedisStore) Push

func (p *RedisStore) Push(queue string, msg *Message) error

type Store

type Store interface {
	Push(queue string, msg *Message) error
	Pop(timeout time.Duration, queues ...string) (string, *Message, error)
	Done(queue string, msg *Message, err error)
}

func NewRedisStore

func NewRedisStore(p *redis.Pool) Store

==============================================================================

type Worker

type Worker interface {
	Do(msg *Message) error
}

Jump to

Keyboard shortcuts

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