Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Close()
- func (c *Client) Consumer(queueName, routingKey, exchangeName string, exclusive bool, dlExchange string) (err error)
- func (c *Client) DelayedExchange(queueName, exchangeName, routingKey string, retryDelay time.Duration) (delayExchange string, err error)
- func (c *Client) Enabled() bool
- func (c *Client) Exclusive(ctx context.Context, name string, timeout time.Duration, ...) (acquired bool, err error)
- func (c *Client) Listen(queueResolver QueueResolver, exchange, routingKey string) (string, <-chan amqp.Delivery, error)
- func (c *Client) Ping() error
- func (c *Client) Publish(payload amqp.Publishing, exchange, routingKey string) error
- func (c *Client) PublishJSON(item any, exchange, routingKey string) error
- func (c *Client) Publisher(exchangeName, exchangeType string, args amqp.Table) (err error)
- func (c *Client) SetupExclusive(name string) (err error)
- func (c *Client) StopListener(consumer string) (err error)
- func (c *Client) Vhost() string
- type Config
- type Connection
- type QueueResolver
Constants ¶
This section is empty.
Variables ¶
var ErrNoConfig = errors.New("URI is required")
ErrNoConfig occurs when URI is not provided
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client wraps all object required for AMQP usage
func New ¶
func New(config Config, prometheusRegister prometheus.Registerer) (*Client, error)
New inits AMQP connection from Config
func NewFromURI ¶ added in v4.28.3
func NewFromURI(uri string, prefetch int, prometheusRegister prometheus.Registerer) (*Client, error)
NewFromURI inits AMQP connection from given URI
func (*Client) Consumer ¶
func (c *Client) Consumer(queueName, routingKey, exchangeName string, exclusive bool, dlExchange string) (err error)
Consumer configures client for consumming from given queue, bind to given exchange, and return delayed Exchange name to publish
func (*Client) DelayedExchange ¶ added in v4.30.1
func (c *Client) DelayedExchange(queueName, exchangeName, routingKey string, retryDelay time.Duration) (delayExchange string, err error)
DelayedExchange configures dead-letter exchange with given ttl
func (*Client) Exclusive ¶ added in v4.29.5
func (c *Client) Exclusive(ctx context.Context, name string, timeout time.Duration, action func(context.Context) error) (acquired bool, err error)
Exclusive get an exclusive lock from given queue during duration
func (*Client) Listen ¶
func (c *Client) Listen(queueResolver QueueResolver, exchange, routingKey string) (string, <-chan amqp.Delivery, error)
Listen listens to configured queue
func (*Client) Publish ¶
func (c *Client) Publish(payload amqp.Publishing, exchange, routingKey string) error
Publish sends payload to the underlying exchange
func (*Client) PublishJSON ¶ added in v4.29.6
PublishJSON sends JSON payload to the underlying exchange
func (*Client) SetupExclusive ¶ added in v4.29.5
SetupExclusive configure the exclusive queue
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 Connection ¶
Connection for AMQP
type QueueResolver ¶ added in v4.30.1
QueueResolver return the name of the queue to listen