Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶ added in v0.5.2
type Channel interface {
PublishWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
}
Channel is a RabbitMQ channel for publishing.
func Wrap ¶ added in v0.5.2
func Wrap(channel Channel, mws ...Middleware) Channel
Wrap channel with middlewares.
type ChannelFunc ¶ added in v0.5.2
type ChannelFunc func(ctx context.Context, exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
ChannelFunc type is an adapter to allow the use of ordinary functions as Channel.
func (ChannelFunc) PublishWithContext ¶ added in v0.5.2
func (f ChannelFunc) PublishWithContext(ctx context.Context, exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error
PublishWithContext implements Channel.
type Middleware ¶ added in v0.5.2
Middleware adds new functionality for publishing.
func WithExpiration ¶
func WithExpiration(expire time.Duration) Middleware
WithExpiration sets publishing Expire property.
func WithHeaders ¶ added in v0.5.2
func WithHeaders(table amqp.Table) Middleware
WithHeaders adds headers to the published message.
func WithImmediate ¶
func WithImmediate() Middleware
WithImmediate sets server to discard a message when no consumer on the matched queue is ready to accept the delivery and server will return an undeliverable message with a Return method. See https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish.immediate.
func WithMandatory ¶
func WithMandatory() Middleware
WithMandatory sets server to discard a message if no queue is bound that matches the routing key and server will return an undeliverable message with a Return method. See https://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.publish.mandatory.
func WithTransientDeliveryMode ¶
func WithTransientDeliveryMode() Middleware
WithTransientDeliveryMode sets publishing to the Transient delivery mode. Transient means higher throughput but messages will not be restored on broker restart. See https://github.com/rabbitmq/amqp091-go/blob/main/types.go#L123.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher is a Publisher to RabbiMQ.