amqp

package
v4.27.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 10 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertDeliveryToPublishing

func ConvertDeliveryToPublishing(message amqp.Delivery) amqp.Publishing

ConvertDeliveryToPublishing convert a delivery to a publishing, for requeuing

Types

type Client

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

Client wraps all object required for AMQP usage

func New

func New(uri string, prometheusRegister prometheus.Registerer) (*Client, error)

New inits AMQP connection, channel and queue

func (*Client) Ack

func (a *Client) Ack(message amqp.Delivery)

Ack ack a message with error handling

func (*Client) Close

func (a *Client) Close()

Close closes opened ressources

func (*Client) Consumer

func (a *Client) Consumer(queueName, topic, exchangeName string, retryDelay time.Duration) (string, error)

Consumer configures client for consumming from given queue, bind to given exchange, and return delayed Exchange name to publish

func (*Client) Enabled

func (a *Client) Enabled() bool

Enabled checks if connection is setup

func (*Client) Listen

func (a *Client) Listen(queue string) (string, <-chan amqp.Delivery, error)

Listen listens to configured queue

func (*Client) Ping

func (a *Client) Ping() error

Ping checks if connection is live

func (*Client) Publish

func (a *Client) Publish(payload amqp.Publishing, exchange string) error

Publish sends payload to the underlying exchange

func (*Client) Publisher

func (a *Client) Publisher(exchangeName, exchangeType string, args amqp.Table) error

Publisher configures client for publishing to given exchange

func (*Client) Reject

func (a *Client) Reject(message amqp.Delivery, requeue bool)

Reject reject a message with error handling

func (*Client) StopListener added in v4.25.0

func (a *Client) StopListener(consumer string)

StopListener cancel consumer listening

func (*Client) Vhost

func (a *Client) Vhost() string

Vhost returns connection Vhost

type Connection

type Connection interface {
	io.Closer
	IsClosed() bool
}

Connection for AMQP

Jump to

Keyboard shortcuts

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