amqp

package
v0.0.0-...-ddf75e5 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MaxParallelism

func MaxParallelism() int

Types

type AnnounceQueue

type AnnounceQueue struct {
	Queue      string
	Passive    bool
	Durable    bool
	Exclusive  bool
	AutoDelete bool
	NoWait     bool
	Arguments  amqp.Table
	// contains filtered or unexported fields
}

type Consumer

type Consumer struct {
	Delivery Delivery
	// contains filtered or unexported fields
}

Consumer holds all information about the RabbitMQ connection This setup does limit a consumer to one exchange. This should not be an issue. Having to connect to multiple exchanges means something else is structured improperly.

func NewConsumer

func NewConsumer(uri, changes, exchangeType, queueName, bindingKey, consumerTag string) *Consumer

func (*Consumer) AnnounceQueue

func (c *Consumer) AnnounceQueue(cfg AnnounceQueue) error

AnnounceQueue sets the queue that will be listened to for this connection...

func (*Consumer) Connect

func (c *Consumer) Connect() error

func (*Consumer) CreateExchange

func (c *Consumer) CreateExchange(exchanges string, exchangeType string) error

func (*Consumer) Handle

func (c *Consumer) Handle(fn func(Delivery), queue string)

Handle has all the logic to make sure your program keeps running d should be a delievey channel as created when you call AnnounceQueue fn should be a function that handles the processing of deliveries this should be the last thing called in main as code under it will become unreachable unless put int a goroutine. The q and rk params are redundant but allow you to have multiple queue listeners in main without them you would be tied into only using one queue per connection

func (*Consumer) Publish

func (c *Consumer) Publish(message []byte) error

func (*Consumer) Reconnect

func (c *Consumer) Reconnect(queueName string) error

Reconnect is called in places where NotifyClose() channel is called wait 30 seconds before trying to reconnect. Any shorter amount of time will likely destroy the error log while waiting for servers to come back online. This requires two parameters which is just to satisfy the AccounceQueue call and allows greater flexability

func (*Consumer) Shutdown

func (c *Consumer) Shutdown() error

type Delivery

type Delivery <-chan amqp.Delivery

Jump to

Keyboard shortcuts

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