Documentation ¶
Index ¶
- type AMQPBroker
- type Broker
- type EagerBroker
- func (eagerBroker *EagerBroker) AssignWorker(w TaskProcessor)
- func (eagerBroker *EagerBroker) GetPendingTasks(queue string) ([]*tasks.Signature, error)
- func (eagerBroker *EagerBroker) Publish(task *tasks.Signature) error
- func (eagerBroker *EagerBroker) StartConsuming(consumerTag string, concurrency int, p TaskProcessor) (bool, error)
- func (eagerBroker *EagerBroker) StopConsuming()
- type EagerMode
- type Interface
- type RedisBroker
- type TaskProcessor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMQPBroker ¶
type AMQPBroker struct { Broker common.AMQPConnector }
AMQPBroker represents an AMQP broker
func (*AMQPBroker) Publish ¶
func (b *AMQPBroker) Publish(signature *tasks.Signature) error
Publish places a new message on the default queue
func (*AMQPBroker) StartConsuming ¶
func (b *AMQPBroker) StartConsuming(consumerTag string, concurrency int, taskProcessor TaskProcessor) (bool, error)
StartConsuming enters a loop and waits for incoming messages
func (*AMQPBroker) StopConsuming ¶
func (b *AMQPBroker) StopConsuming()
StopConsuming quits the loop
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker represents a base broker structure
func (*Broker) AdjustRoutingKey ¶
AdjustRoutingKey makes sure the routing key is correct. If the routing key is an empty string: a) set it to binding key for direct exchange type b) set it to default queue name
func (*Broker) GetPendingTasks ¶
GetPendingTasks returns a slice of task.Signatures waiting in the queue
func (*Broker) IsTaskRegistered ¶
IsTaskRegistered returns true if the task is registered with this broker
func (*Broker) SetRegisteredTaskNames ¶
SetRegisteredTaskNames sets registered task names
type EagerBroker ¶
type EagerBroker struct { Broker // contains filtered or unexported fields }
EagerBroker represents an "eager" in-memory broker
func (*EagerBroker) AssignWorker ¶
func (eagerBroker *EagerBroker) AssignWorker(w TaskProcessor)
AssignWorker assigns a worker to the eager broker
func (*EagerBroker) GetPendingTasks ¶
func (eagerBroker *EagerBroker) GetPendingTasks(queue string) ([]*tasks.Signature, error)
GetPendingTasks returns a slice of task.Signatures waiting in the queue
func (*EagerBroker) Publish ¶
func (eagerBroker *EagerBroker) Publish(task *tasks.Signature) error
Publish places a new message on the default queue
func (*EagerBroker) StartConsuming ¶
func (eagerBroker *EagerBroker) StartConsuming(consumerTag string, concurrency int, p TaskProcessor) (bool, error)
StartConsuming enters a loop and waits for incoming messages
func (*EagerBroker) StopConsuming ¶
func (eagerBroker *EagerBroker) StopConsuming()
StopConsuming quits the loop
type EagerMode ¶
type EagerMode interface {
AssignWorker(p TaskProcessor)
}
EagerMode interface with methods specific for this broker
type Interface ¶
type Interface interface { SetRegisteredTaskNames(names []string) IsTaskRegistered(name string) bool StartConsuming(consumerTag string, concurrency int, p TaskProcessor) (bool, error) StopConsuming() Publish(task *tasks.Signature) error GetPendingTasks(queue string) ([]*tasks.Signature, error) }
Interface - a common interface for all brokers
func NewAMQPBroker ¶
NewAMQPBroker creates new AMQPBroker instance
func NewEagerBroker ¶
func NewEagerBroker() Interface
NewEagerBroker creates new EagerBroker instance
type RedisBroker ¶
type RedisBroker struct { Broker common.RedisConnector // contains filtered or unexported fields }
RedisBroker represents a Redis broker
func (*RedisBroker) GetPendingTasks ¶
func (b *RedisBroker) GetPendingTasks(queue string) ([]*tasks.Signature, error)
GetPendingTasks returns a slice of task signatures waiting in the queue
func (*RedisBroker) Publish ¶
func (b *RedisBroker) Publish(signature *tasks.Signature) error
Publish places a new message on the default queue
func (*RedisBroker) StartConsuming ¶
func (b *RedisBroker) StartConsuming(consumerTag string, concurrency int, taskProcessor TaskProcessor) (bool, error)
StartConsuming enters a loop and waits for incoming messages
func (*RedisBroker) StopConsuming ¶
func (b *RedisBroker) StopConsuming()
StopConsuming quits the loop
type TaskProcessor ¶
TaskProcessor - can process a delivered task This will probably always be a worker instance