Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrAlreadyClosed = errors.New("consumer.Listener: already closed")
ErrAlreadyClosed is returned by the consumer when closing a previously-closed Listener.
Functions ¶
func AutoAck ¶
func AutoAck(listener *Listener)
AutoAck automatically acknowledges a message as soon as the AMQP broker delivers it to the Consumer.
This might lead to message loss scenarios in case the consumer gets abruptly closed.
Types ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener allows to listen for incoming messages from a consumer, which is attached to one or more queues.
Use Listen function to create a new Listener instance.
func Listen ¶
Listen returns a new Listener able to listen and serve incoming messages on one or more AMQP queues.
func (Listener) Listen ¶
func (l Listener) Listen(conn listener.Connection, ch listener.Channel, h handler.Handler) (listener.Closer, error)
Listen starts listening to incoming messages on the specified queue (or queues) using the provided Connection or Channel, and serving them by using the provided Handler.
An error is returned if the Listener is unable to start listening on the provided Channel.
type Option ¶
type Option func(*Listener)
Option is an optional functionality that can be added to the Listener that is being initialized by the Listen factory method.
func Arguments ¶
Arguments specifies optional arguments to be supplied during queue declaration.
Multiple calls of this option are supported.
func Description ¶
Description adds a description for the consumer.
func OnError ¶
OnError specifies the callback function to execute when the message handler fails with an error, providing the amqp.Delivery and the error returned by the handler itself.
If not specified, the Server will call amqp.Delivery.Nack(false, true).