Documentation ¶
Index ¶
- Variables
- func ConvertDeliveryToPublishing(message amqp.Delivery) amqp.Publishing
- func GetDeathCount(message amqp.Delivery) (int64, error)
- type Client
- func (a *Client) Ack(message amqp.Delivery)
- func (a *Client) Close()
- func (a *Client) Consumer(queueName, topic, exchangeName string, retryDelay time.Duration) (string, error)
- func (a *Client) Enabled() bool
- func (a *Client) Listen(queue string) (string, <-chan amqp.Delivery, error)
- func (a *Client) Ping() error
- func (a *Client) Publish(payload amqp.Publishing, exchange string) error
- func (a *Client) Publisher(exchangeName, exchangeType string, args amqp.Table) error
- func (a *Client) Reject(message amqp.Delivery, requeue bool)
- func (c *Client) Retry(message amqp.Delivery, maxRetry int64, delayExchange string) (DeliveryStatus, error)
- func (a *Client) StopListener(consumer string)
- func (a *Client) Vhost() string
- type Config
- type Connection
- type DeliveryStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoDeathCount = errors.New("no death count")
ErrNoDeathCount occurs when no death count is found in message
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(config Config, prometheusRegister prometheus.Registerer) (*Client, error)
New inits AMQP connection, channel and queue
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) Publish ¶
func (a *Client) Publish(payload amqp.Publishing, exchange string) error
Publish sends payload to the underlying exchange
func (*Client) Retry ¶ added in v4.28.2
func (c *Client) Retry(message amqp.Delivery, maxRetry int64, delayExchange string) (DeliveryStatus, error)
Retry a message if possible on error
func (*Client) StopListener ¶ added in v4.25.0
StopListener cancel consumer listening
type Config ¶ added in v4.28.2
type Config struct {
// contains filtered or unexported fields
}
Config of package
type DeliveryStatus ¶ added in v4.28.2
type DeliveryStatus int
DeliveryStatus on error
const ( // DeliveryRejected when message is dropped DeliveryRejected DeliveryStatus = iota // DeliveryDelayed when message is sent in delay queue DeliveryDelayed )
Click to show internal directories.
Click to hide internal directories.