Documentation ¶
Index ¶
- func BackendFactory(cnf *config.Config) (backends.Interface, error)
- func BrokerFactory(cnf *config.Config) (brokers.Interface, error)
- func ParseRedisSocketURL(url string) (path, password string, db int, err error)
- func ParseRedisURL(url string) (host, password string, db int, err error)
- type Server
- func (server *Server) GetBackend() backends.Interface
- func (server *Server) GetBroker() brokers.Interface
- 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, concurrency int) *Worker
- func (server *Server) RegisterTask(name string, taskFunc interface{}) error
- func (server *Server) RegisterTasks(namedTaskFuncs map[string]interface{}) error
- func (server *Server) SendChain(chain *tasks.Chain) (*backends.ChainAsyncResult, error)
- func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain) (*backends.ChainAsyncResult, error)
- func (server *Server) SendChord(chord *tasks.Chord, sendConcurrency int) (*backends.ChordAsyncResult, error)
- func (server *Server) SendChordWithContext(ctx context.Context, chord *tasks.Chord, sendConcurrency int) (*backends.ChordAsyncResult, error)
- func (server *Server) SendGroup(group *tasks.Group, sendConcurrency int) ([]*backends.AsyncResult, error)
- func (server *Server) SendGroupWithContext(ctx context.Context, group *tasks.Group, sendConcurrency int) ([]*backends.AsyncResult, error)
- func (server *Server) SendTask(signature *tasks.Signature) (*backends.AsyncResult, error)
- func (server *Server) SendTaskWithContext(ctx context.Context, signature *tasks.Signature) (*backends.AsyncResult, error)
- func (server *Server) SetBackend(backend backends.Interface)
- func (server *Server) SetBroker(broker brokers.Interface)
- 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 of backends.Interface Currently supported backends are AMQP/S and Memcache
func BrokerFactory ¶
BrokerFactory creates a new object of brokers.Interface Currently only AMQP/S broker is supported
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.
Types ¶
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) SendChainWithContext ¶ added in v1.2.2
func (server *Server) SendChainWithContext(ctx context.Context, chain *tasks.Chain) (*backends.ChainAsyncResult, error)
SendChainWithContext will inject the trace context in all the signature headers before publishing it
func (*Server) SendChord ¶
func (server *Server) SendChord(chord *tasks.Chord, sendConcurrency int) (*backends.ChordAsyncResult, error)
SendChord triggers a group of parallel tasks with a callback
func (*Server) SendChordWithContext ¶ added in v1.2.2
func (server *Server) SendChordWithContext(ctx context.Context, chord *tasks.Chord, sendConcurrency int) (*backends.ChordAsyncResult, error)
SendChordWithContext will inject the trace context in all the signature headers before publishing it
func (*Server) SendGroup ¶
func (server *Server) SendGroup(group *tasks.Group, sendConcurrency int) ([]*backends.AsyncResult, error)
SendGroup triggers a group of parallel tasks
func (*Server) SendGroupWithContext ¶ added in v1.2.2
func (server *Server) SendGroupWithContext(ctx context.Context, group *tasks.Group, sendConcurrency int) ([]*backends.AsyncResult, error)
SendGroupWithContext will inject the trace context in all the signature headers before publishing it
func (*Server) SendTaskWithContext ¶ added in v1.2.2
func (server *Server) SendTaskWithContext(ctx context.Context, signature *tasks.Signature) (*backends.AsyncResult, error)
SendTaskWithContext will inject the trace context in the signature headers before publishing it
func (*Server) SetBackend ¶
SetBackend sets backend
type Worker ¶
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) LaunchAsync ¶ added in v1.0.10
LaunchAsync is a non blocking version of Launch