Documentation ¶
Index ¶
- func BackendFactory(cnf *config.Config) (backends.Backend, error)
- func BrokerFactory(cnf *config.Config) (brokers.Broker, error)
- func CreateTaskResult(value reflect.Value) *backends.TaskResult
- func ParseRedisSocketURL(url string) (path, password string, db int, err error)
- func ParseRedisURL(url string) (host, password string, db int, err error)
- func ReflectArgs(args []signatures.TaskArg) ([]reflect.Value, error)
- func TryCall(f reflect.Value, args []reflect.Value) (results []reflect.Value, err error)
- type Chain
- type Chord
- type Group
- type Server
- func (server *Server) GetBackend() backends.Backend
- func (server *Server) GetBroker() brokers.Broker
- func (server *Server) GetConfig() *config.Config
- func (server *Server) GetRegisteredTask(name string) (interface{}, error)
- func (server *Server) GetRegisteredTaskNames() []string
- func (server *Server) IsTaskRegistered(name string) bool
- func (server *Server) NewWorker(consumerTag string) *Worker
- func (server *Server) RegisterTask(name string, task interface{})
- func (server *Server) RegisterTasks(tasks map[string]interface{})
- func (server *Server) SendChain(chain *Chain) (*backends.ChainAsyncResult, error)
- func (server *Server) SendChord(chord *Chord) (*backends.ChordAsyncResult, error)
- func (server *Server) SendGroup(group *Group) ([]*backends.AsyncResult, error)
- func (server *Server) SendTask(signature *signatures.TaskSignature) (*backends.AsyncResult, error)
- func (server *Server) SetBackend(backend backends.Backend)
- func (server *Server) SetBroker(broker brokers.Broker)
- func (server *Server) SetConfig(cnf *config.Config)
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackendFactory ¶
BackendFactory creates a new object with backends.Backend interface Currently supported backends are AMQP and Memcache
func BrokerFactory ¶
BrokerFactory creates a new object with brokers.Broker interface Currently only AMQP broker is supported
func CreateTaskResult ¶
func CreateTaskResult(value reflect.Value) *backends.TaskResult
CreateTaskResult ...
func ParseRedisSocketURL ¶
ParseRedisSocketURL extracts Redis connection options from a URL with the redis+socket:// scheme. This scheme is not standard (or even de facto) and is used as a transitional mechanism until the the config package gains the proper facilities to support socket-based connections.
func ParseRedisURL ¶
ParseRedisURL ...
func ReflectArgs ¶
func ReflectArgs(args []signatures.TaskArg) ([]reflect.Value, error)
ReflectArgs converts []TaskArg to []reflect.Value
Types ¶
type Chain ¶
type Chain struct {
Tasks []*signatures.TaskSignature
}
Chain creates a chain of tasks to be executed one after another
func NewChain ¶
func NewChain(tasks ...*signatures.TaskSignature) *Chain
NewChain creates Chain instance
type Chord ¶
type Chord struct { Group *Group Callback *signatures.TaskSignature }
Chord adds an optional callback to the group to be executed after all tasks in the group finished
func NewChord ¶
func NewChord(group *Group, callback *signatures.TaskSignature) *Chord
NewChord creates Chord instance
type Group ¶
type Group struct { GroupUUID string Tasks []*signatures.TaskSignature }
Group creates a set of tasks to be executed in parallel
func NewGroup ¶
func NewGroup(tasks ...*signatures.TaskSignature) *Group
NewGroup creates Group instance
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the main Machinery object and stores all configuration All the tasks workers process are registered against the server
func (*Server) GetBackend ¶
GetBackend returns backend
func (*Server) GetRegisteredTask ¶
GetRegisteredTask returns registered task by name
func (*Server) GetRegisteredTaskNames ¶
GetRegisteredTaskNames returns slice of registered task names
func (*Server) IsTaskRegistered ¶
IsTaskRegistered returns true if the task name is registered with this broker
func (*Server) RegisterTask ¶
RegisterTask registers a single task
func (*Server) RegisterTasks ¶
RegisterTasks registers all tasks at once
func (*Server) SendChain ¶
func (server *Server) SendChain(chain *Chain) (*backends.ChainAsyncResult, error)
SendChain triggers a chain of tasks
func (*Server) SendChord ¶
func (server *Server) SendChord(chord *Chord) (*backends.ChordAsyncResult, error)
SendChord triggers a group of parallel tasks with a callback
func (*Server) SendGroup ¶
func (server *Server) SendGroup(group *Group) ([]*backends.AsyncResult, error)
SendGroup triggers a group of parallel tasks
func (*Server) SendTask ¶
func (server *Server) SendTask(signature *signatures.TaskSignature) (*backends.AsyncResult, error)
SendTask publishes a task to the default queue
func (*Server) SetBackend ¶
SetBackend sets backend
type Worker ¶
type Worker struct { ConsumerTag string // contains filtered or unexported fields }
Worker represents a single worker process
func (*Worker) Launch ¶
Launch starts a new worker process. The worker subscribes to the default queue and processes incoming registered tasks
func (*Worker) Process ¶
func (worker *Worker) Process(signature *signatures.TaskSignature) error
Process handles received tasks and triggers success/error callbacks