Documentation
¶
Index ¶
- type ExchangeOptions
- type MessageHandler
- type PublishOptions
- type QueueOptions
- type RabbitMQ
- func (rq *RabbitMQ) BindQueue(queue, exchange, routingKey string, args amqp091.Table) error
- func (rq *RabbitMQ) Close() error
- func (rq *RabbitMQ) Consume(ctx context.Context, queue string, handler MessageHandler) error
- func (rq *RabbitMQ) DeclareExchange(name, exchangeType string, options ExchangeOptions) error
- func (rq *RabbitMQ) DeclareQueue(name string, options QueueOptions) (amqp091.Queue, error)
- func (rq *RabbitMQ) GetChannel(name string) (*amqp091.Channel, error)
- func (rq *RabbitMQ) IsConnected() bool
- func (rq *RabbitMQ) Publish(ctx context.Context, exchange, routingKey string, body []byte) error
- func (rq *RabbitMQ) PublishWithOptions(ctx context.Context, exchange, routingKey string, body []byte, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExchangeOptions ¶
type ExchangeOptions struct {
Durable bool
AutoDelete bool
Internal bool
NoWait bool
Arguments amqp091.Table
}
ExchangeOptions represents options for declaring exchanges
func DefaultExchangeOptions ¶
func DefaultExchangeOptions() ExchangeOptions
DefaultExchangeOptions returns default exchange options
type MessageHandler ¶
MessageHandler is a function that handles consumed messages
type PublishOptions ¶
type PublishOptions struct {
ContentType string
DeliveryMode uint8
Priority uint8
Expiration string
MessageID string
UserID string
AppID string
Headers amqp091.Table
Mandatory bool
Immediate bool
}
PublishOptions represents options for publishing messages
func DefaultPublishOptions ¶
func DefaultPublishOptions() PublishOptions
DefaultPublishOptions returns default publishing options
type QueueOptions ¶
type QueueOptions struct {
Durable bool
AutoDelete bool
Exclusive bool
NoWait bool
Arguments amqp091.Table
}
QueueOptions represents options for declaring queues
func DefaultQueueOptions ¶
func DefaultQueueOptions() QueueOptions
DefaultQueueOptions returns default queue options
type RabbitMQ ¶
type RabbitMQ struct {
// contains filtered or unexported fields
}
RabbitMQ represents a RabbitMQ client
func NewRabbitMQ ¶
NewRabbitMQ creates a new RabbitMQ client
func (*RabbitMQ) DeclareExchange ¶
func (rq *RabbitMQ) DeclareExchange(name, exchangeType string, options ExchangeOptions) error
DeclareExchange declares an exchange
func (*RabbitMQ) DeclareQueue ¶
DeclareQueue declares a queue
func (*RabbitMQ) GetChannel ¶
GetChannel returns a channel for the given name
func (*RabbitMQ) IsConnected ¶
IsConnected returns the connection status
func (*RabbitMQ) PublishWithOptions ¶
func (rq *RabbitMQ) PublishWithOptions(ctx context.Context, exchange, routingKey string, body []byte, options PublishOptions) error
PublishWithOptions publishes a message with custom options