Documentation ¶
Overview ¶
Package rabbitmq - all structs like SmthParams are wrappers for amqp091-go library function arguments for documentation and usage examples see: - https://github.com/rabbitmq/amqp091-go - https://www.rabbitmq.com/documentation.html
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dial ¶
func Dial(cfg DialConfig) (*amqp.Connection, error)
Dial a handy wrapper for base "github.com/rabbitmq/amqp091-go" DialConfig function
Types ¶
type AMQPConsumer ¶
type AMQPConsumer struct { ExchangeParams QueueParams QueueBindParams ConsumerParams IConsumer }
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cfg ClientConfig) (*Client, error)
func (*Client) Consume ¶
func (c *Client) Consume(consumer AMQPConsumer) error
type ClientConfig ¶
type ClientConfig struct { // this callback will be invoked whenever network failure happens or node shuts down NetworkErrCallback func(*amqp.Error) // note that this interval is taken into account when on reconnecting multiple times in row AutoRecoveryInterval time.Duration // this callback will be invoked whenever connection retry fails or resource freeing returns error // returning value as bool should indicate whether to keep retrying recovery or not AutoRecoveryErrCallback func(error) bool // this callback will be called if restoring a consumer fails after recovery procedure ConsumerAutoRecoveryErrCallback func(AMQPConsumer, error) // configurations for setting up dial and new connection DialConfig PublisherConfirmEnabled bool PublisherConfirmNowait bool ConsumerQos int ConsumerPrefetchSize int ConsumerGlobal bool }
type ConsumerFunc ¶
type ConsumerParams ¶
type DialConfig ¶
type ExchangeParams ¶
type IConsumer ¶
An IConsumer handles an amqp message (delivery - in terms of github.com/rabbitmq/amqp091-go library).
Underlying implementations are responsible for either `Acknowledge` or `Reject` of the message.
HINT: one can consume messages the same way as http request handling via http.Handler i.e. building chain of middlewares for: panic-handling, logging, tracing and error-handling ...etc.
type LogConsumer ¶
type LogConsumer struct {
// contains filtered or unexported fields
}
LogConsumer consumer which logs incoming messages this is just an example, not aimed for production usage