Documentation
¶
Index ¶
- type Client
- func (c *Client) Channel() *amqp.Channel
- func (c *Client) Close() error
- func (c *Client) Consume(ctx context.Context, queue string, prefetch int, ...) error
- func (c *Client) IsLive() bool
- func (c *Client) IsReady() bool
- func (c *Client) Iter(ctx context.Context, queue string, prefetch int) func(yield func(delivery amqp.Delivery) bool) error
- func (c *Client) Publish(ctx context.Context, exchange, key string, pub amqp.Publishing) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a RabbitMQ client.
func (*Client) Channel ¶
Channel returns the current channel. Please note that the channel can be closed and Client will re-open another one and use it, but this one will remain closed.
func (*Client) Consume ¶
func (c *Client) Consume(ctx context.Context, queue string, prefetch int, deliveries chan<- amqp.Delivery) error
Consume consumes messages from a queue into deliveries channel.
func (*Client) IsReady ¶
IsReady returns true if connection and channel are opened and ready to use.
type Option ¶
type Option func(c *Client)
Option is a configuration option for the client.
func WithBackoff ¶
func WithBackoff(bo backoff.BackOff) Option
WithBackoff sets the backoff strategy for reconnecting.
func WithDialConfig ¶
WithDialConfig allows to configure the dial config.
func WithOnChannelClosed ¶
WithOnChannelClosed sets the function to be called when the channel is closed.
func WithOnConnectionClosed ¶
WithOnConnectionClosed sets the function to be called when the connection is closed.