brokers

package
v0.0.0-...-df48c48 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2015 License: BSD-2-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AMQPBroker

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

AMQPBroker represents an AMQP broker

func (*AMQPBroker) IsTaskRegistered

func (amqpBroker *AMQPBroker) IsTaskRegistered(name string) bool

IsTaskRegistered returns true if the task is registered with this broker

func (*AMQPBroker) Publish

func (amqpBroker *AMQPBroker) Publish(signature *signatures.TaskSignature) error

Publish places a new message on the default queue

func (*AMQPBroker) SetRegisteredTaskNames

func (amqpBroker *AMQPBroker) SetRegisteredTaskNames(names []string)

SetRegisteredTaskNames sets registered task names

func (*AMQPBroker) StartConsuming

func (amqpBroker *AMQPBroker) StartConsuming(consumerTag string, taskProcessor TaskProcessor) (bool, error)

StartConsuming enters a loop and waits for incoming messages

func (*AMQPBroker) StopConsuming

func (amqpBroker *AMQPBroker) StopConsuming()

StopConsuming quits the loop

type Broker

type Broker interface {
	SetRegisteredTaskNames(names []string)
	IsTaskRegistered(name string) bool
	StartConsuming(consumerTag string, p TaskProcessor) (bool, error)
	StopConsuming()
	Publish(task *signatures.TaskSignature) error
}

Broker - a common interface for all brokers

func NewAMQPBroker

func NewAMQPBroker(cnf *config.Config) Broker

NewAMQPBroker creates new AMQPBroker instance

func NewEagerBroker

func NewEagerBroker() Broker

func NewRedisBroker

func NewRedisBroker(cnf *config.Config, host string) Broker

NewRedisBroker creates new RedisBroker instance

type EagerBroker

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

func (*EagerBroker) AssignWorker

func (e *EagerBroker) AssignWorker(p TaskProcessor)

Eager interface

func (*EagerBroker) IsTaskRegistered

func (e *EagerBroker) IsTaskRegistered(name string) bool

func (*EagerBroker) Publish

func (e *EagerBroker) Publish(task *signatures.TaskSignature) error

func (*EagerBroker) SetRegisteredTaskNames

func (e *EagerBroker) SetRegisteredTaskNames(names []string)

Broker interface

func (*EagerBroker) StartConsuming

func (e *EagerBroker) StartConsuming(consumerTag string, p TaskProcessor) (bool, error)

func (*EagerBroker) StopConsuming

func (e *EagerBroker) StopConsuming()

type EagerMode

type EagerMode interface {
	AssignWorker(p TaskProcessor)
}

type RedisBroker

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

RedisBroker represents a Redis broker

func (*RedisBroker) IsTaskRegistered

func (redisBroker *RedisBroker) IsTaskRegistered(name string) bool

IsTaskRegistered returns true if the task is registered with this broker

func (*RedisBroker) Publish

func (redisBroker *RedisBroker) Publish(signature *signatures.TaskSignature) error

Publish places a new message on the default queue

func (*RedisBroker) SetRegisteredTaskNames

func (redisBroker *RedisBroker) SetRegisteredTaskNames(names []string)

SetRegisteredTaskNames sets registered task names

func (*RedisBroker) StartConsuming

func (redisBroker *RedisBroker) StartConsuming(consumerTag string, taskProcessor TaskProcessor) (bool, error)

StartConsuming enters a loop and waits for incoming messages

func (*RedisBroker) StopConsuming

func (redisBroker *RedisBroker) StopConsuming()

StopConsuming quits the loop

type TaskProcessor

type TaskProcessor interface {
	Process(signature *signatures.TaskSignature) error
}

TaskProcessor - can process a delivered task This will probably always be a worker instance

Jump to

Keyboard shortcuts

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