amqp

package
v1.10.8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MPL-2.0 Imports: 14 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cnf *config.Config) iface.Broker

New creates new Broker instance

Types

type AMQPConnection added in v1.4.9

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

type Broker

type Broker struct {
	common.Broker
	common.AMQPConnector
	// contains filtered or unexported fields
}

Broker represents an AMQP broker

func (*Broker) AdjustRoutingKey

func (b *Broker) AdjustRoutingKey(s *tasks.Signature)

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) CloseConnections added in v1.4.9

func (b *Broker) CloseConnections() error

func (*Broker) GetOrOpenConnection added in v1.4.9

func (b *Broker) GetOrOpenConnection(queueName string, queueBindingKey string, exchangeDeclareArgs, queueDeclareArgs, queueBindingArgs amqp.Table) (*AMQPConnection, error)

GetOrOpenConnection will return a connection on a particular queue name. Open connections are saved to avoid having to reopen connection for multiple queues

func (*Broker) GetPendingTasks added in v1.7.4

func (b *Broker) GetPendingTasks(queue string) ([]*tasks.Signature, error)

func (*Broker) Publish

func (b *Broker) Publish(ctx context.Context, signature *tasks.Signature) error

Publish places a new message on the default queue

func (*Broker) StartConsuming

func (b *Broker) StartConsuming(consumerTag string, concurrency int, taskProcessor iface.TaskProcessor) (bool, error)

StartConsuming enters a loop and waits for incoming messages

func (*Broker) StopConsuming

func (b *Broker) StopConsuming()

StopConsuming quits the loop

Jump to

Keyboard shortcuts

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