Documentation
ΒΆ
Index ΒΆ
- func DefaultLogger(scope Scope, name string, msg string, attributes map[string]any)
- func GetAttempts(msg *amqp.Delivery) int
- func GetMessageHeader[T any](msg *amqp.Delivery, key string) (value T, ok bool)
- func RejectWithRetry(msg *amqp.Delivery, ttl time.Duration) error
- func SetLogger(cb func(scope Scope, name string, msg string, attributes map[string]any))
- type Connection
- type ConnectionOptions
- type ConstantRetryStrategy
- type Consumer
- func (c *Consumer) AddBinding(exchangeName string, routingKey string, args mo.Option[amqp.Table]) error
- func (c *Consumer) Close() error
- func (svc *Consumer) Collect(ch chan<- prometheus.Metric)
- func (c *Consumer) Consume() <-chan *amqp.Delivery
- func (svc *Consumer) Describe(ch chan<- *prometheus.Desc)
- func (c *Consumer) RemoveBinding(exchangeName string, routingKey string, args mo.Option[amqp.Table]) error
- type ConsumerOptions
- type ConsumerOptionsBinding
- type ConsumerOptionsMessage
- type ConsumerOptionsMetrics
- type ConsumerOptionsMetricsThreshold
- func NewConsumerOptionsMetricsThresholdError(v float64) ConsumerOptionsMetricsThreshold
- func NewConsumerOptionsMetricsThresholdErrorFunc(f func() float64) ConsumerOptionsMetricsThreshold
- func NewConsumerOptionsMetricsThresholdWarning(v float64) ConsumerOptionsMetricsThreshold
- func NewConsumerOptionsMetricsThresholdWarningAndError(v1 float64, v2 float64) ConsumerOptionsMetricsThreshold
- func NewConsumerOptionsMetricsThresholdWarningFunc(f func() float64) ConsumerOptionsMetricsThreshold
- func NewConsumerOptionsMetricsThresholdWarningFuncAndErrorFunc(f1 func() float64, f2 func() float64) ConsumerOptionsMetricsThreshold
- type ConsumerOptionsQueue
- type ExchangeKind
- type ExponentialRetryStrategy
- type LazyRetryStrategy
- type Producer
- func (p *Producer) Close() error
- func (p *Producer) Publish(routingKey string, mandatory bool, immediate bool, msg amqp.Publishing) error
- func (p *Producer) PublishWithContext(ctx context.Context, routingKey string, mandatory bool, immediate bool, ...) error
- func (p *Producer) PublishWithDeferredConfirm(routingKey string, mandatory bool, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)
- func (p *Producer) PublishWithDeferredConfirmWithContext(ctx context.Context, routingKey string, mandatory bool, immediate bool, ...) (*amqp.DeferredConfirmation, error)
- type ProducerOptions
- type ProducerOptionsExchange
- type QueueSetupExchangeOptions
- type QueueSetupOptions
- type QueueSetupQueueOptions
- type RetryConsistency
- type RetryStrategy
- type Scope
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func DefaultLogger ΒΆ added in v1.0.0
func GetAttempts ΒΆ added in v1.5.0
func GetMessageHeader ΒΆ added in v1.5.0
func RejectWithRetry ΒΆ added in v1.5.0
Types ΒΆ
type Connection ΒΆ added in v1.0.0
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ΒΆ added in v1.0.0
func NewConnection(name string, opt ConnectionOptions) (*Connection, error)
func (*Connection) Close ΒΆ added in v1.0.0
func (c *Connection) Close() error
func (*Connection) IsClosed ΒΆ added in v1.0.0
func (c *Connection) IsClosed() bool
func (*Connection) ListenConnection ΒΆ added in v1.0.0
func (c *Connection) ListenConnection() (func(), <-chan *amqp.Connection)
ListenConnection implements the Observable pattern.
type ConnectionOptions ΒΆ added in v1.0.0
type ConstantRetryStrategy ΒΆ added in v1.3.0
type ConstantRetryStrategy struct {
// contains filtered or unexported fields
}
func (*ConstantRetryStrategy) NextBackOff ΒΆ added in v1.3.0
type Consumer ΒΆ added in v1.0.0
type Consumer struct {
// contains filtered or unexported fields
}
func NewConsumer ΒΆ added in v1.0.0
func NewConsumer(conn *Connection, name string, opt ConsumerOptions) *Consumer
func (*Consumer) AddBinding ΒΆ added in v1.2.0
func (*Consumer) Collect ΒΆ added in v1.8.0
func (svc *Consumer) Collect(ch chan<- prometheus.Metric)
func (*Consumer) Describe ΒΆ added in v1.8.0
func (svc *Consumer) Describe(ch chan<- *prometheus.Desc)
type ConsumerOptions ΒΆ added in v1.0.0
type ConsumerOptions struct {
Queue ConsumerOptionsQueue
Bindings []ConsumerOptionsBinding
Message ConsumerOptionsMessage
// optional arguments
Metrics ConsumerOptionsMetrics
EnableDeadLetter mo.Option[bool] // default false
Defer mo.Option[time.Duration] // default no Defer
ConsumeArgs mo.Option[amqp.Table] // default nil
RetryStrategy mo.Option[RetryStrategy] // default no retry
RetryConsistency mo.Option[RetryConsistency] // default eventually consistent
}
type ConsumerOptionsBinding ΒΆ added in v1.0.0
type ConsumerOptionsMessage ΒΆ added in v1.0.0
type ConsumerOptionsMetrics ΒΆ added in v1.8.0
type ConsumerOptionsMetrics struct {
QueueMessageBytesThreshold ConsumerOptionsMetricsThreshold
QueueMessagesThreshold ConsumerOptionsMetricsThreshold
DeadLetterQueueMessageBytesThreshold ConsumerOptionsMetricsThreshold
DeadLetterQueueMessagesThreshold ConsumerOptionsMetricsThreshold
DeadLetterQueueMessageRateThreshold ConsumerOptionsMetricsThreshold
RetryQueueMessageBytesThreshold ConsumerOptionsMetricsThreshold
RetryQueueMessagesThreshold ConsumerOptionsMetricsThreshold
RetryQueueMessageRateThreshold ConsumerOptionsMetricsThreshold
}
type ConsumerOptionsMetricsThreshold ΒΆ added in v1.11.0
type ConsumerOptionsMetricsThreshold struct {
// contains filtered or unexported fields
}
func NewConsumerOptionsMetricsThresholdError ΒΆ added in v1.8.0
func NewConsumerOptionsMetricsThresholdError(v float64) ConsumerOptionsMetricsThreshold
func NewConsumerOptionsMetricsThresholdErrorFunc ΒΆ added in v1.8.0
func NewConsumerOptionsMetricsThresholdErrorFunc(f func() float64) ConsumerOptionsMetricsThreshold
func NewConsumerOptionsMetricsThresholdWarning ΒΆ added in v1.8.0
func NewConsumerOptionsMetricsThresholdWarning(v float64) ConsumerOptionsMetricsThreshold
func NewConsumerOptionsMetricsThresholdWarningAndError ΒΆ added in v1.8.0
func NewConsumerOptionsMetricsThresholdWarningAndError(v1 float64, v2 float64) ConsumerOptionsMetricsThreshold
func NewConsumerOptionsMetricsThresholdWarningFunc ΒΆ added in v1.8.0
func NewConsumerOptionsMetricsThresholdWarningFunc(f func() float64) ConsumerOptionsMetricsThreshold
func NewConsumerOptionsMetricsThresholdWarningFuncAndErrorFunc ΒΆ added in v1.8.0
func NewConsumerOptionsMetricsThresholdWarningFuncAndErrorFunc(f1 func() float64, f2 func() float64) ConsumerOptionsMetricsThreshold
type ConsumerOptionsQueue ΒΆ added in v1.0.0
type ExchangeKind ΒΆ
type ExchangeKind string
const ( ExchangeKindDirect ExchangeKind = "direct" ExchangeKindFanout ExchangeKind = "fanout" ExchangeKindTopic ExchangeKind = "topic" ExchangeKindHeaders ExchangeKind = "headers" )
type ExponentialRetryStrategy ΒΆ added in v1.3.0
type ExponentialRetryStrategy struct {
// contains filtered or unexported fields
}
func (*ExponentialRetryStrategy) NextBackOff ΒΆ added in v1.3.0
type LazyRetryStrategy ΒΆ added in v1.5.0
type LazyRetryStrategy struct {
// contains filtered or unexported fields
}
func (*LazyRetryStrategy) NextBackOff ΒΆ added in v1.5.0
type Producer ΒΆ added in v1.0.0
type Producer struct {
// contains filtered or unexported fields
}
func NewProducer ΒΆ added in v1.0.0
func NewProducer(conn *Connection, name string, opt ProducerOptions) *Producer
func (*Producer) PublishWithContext ΒΆ added in v1.0.0
func (*Producer) PublishWithDeferredConfirm ΒΆ added in v1.0.0
func (p *Producer) PublishWithDeferredConfirm(routingKey string, mandatory bool, immediate bool, msg amqp.Publishing) (*amqp.DeferredConfirmation, error)
func (*Producer) PublishWithDeferredConfirmWithContext ΒΆ added in v1.0.0
type ProducerOptions ΒΆ added in v1.0.0
type ProducerOptions struct {
Exchange ProducerOptionsExchange
}
type ProducerOptionsExchange ΒΆ added in v1.0.0
type ProducerOptionsExchange struct {
Name mo.Option[string] // default "amq.direct"
Kind mo.Option[ExchangeKind] // default "direct"
// optional arguments
Durable mo.Option[bool] // default true
AutoDelete mo.Option[bool] // default false
Internal mo.Option[bool] // default false
NoWait mo.Option[bool] // default false
Args mo.Option[amqp.Table] // default nil
}
type QueueSetupExchangeOptions ΒΆ added in v1.6.0
type QueueSetupExchangeOptions struct {
// contains filtered or unexported fields
}
type QueueSetupOptions ΒΆ added in v1.6.0
type QueueSetupOptions struct {
Exchange QueueSetupExchangeOptions
Queue QueueSetupQueueOptions
}
type QueueSetupQueueOptions ΒΆ added in v1.6.0
type QueueSetupQueueOptions struct {
// contains filtered or unexported fields
}
type RetryConsistency ΒΆ added in v1.3.0
type RetryConsistency int
const ( ConsistentRetry RetryConsistency = 0 // slow EventuallyConsistentRetry RetryConsistency = 1 // fast, at *least* once )
type RetryStrategy ΒΆ added in v1.3.0
func NewConstantRetryStrategy ΒΆ added in v1.3.0
func NewConstantRetryStrategy(maxRetry int, interval time.Duration) RetryStrategy
func NewExponentialRetryStrategy ΒΆ added in v1.3.0
func NewExponentialRetryStrategy(maxRetry int, initialInterval time.Duration, intervalMultiplier float64) RetryStrategy
func NewLazyRetryStrategy ΒΆ added in v1.5.0
func NewLazyRetryStrategy(maxRetry int) RetryStrategy
ManualRetryStrategy is a retry strategy that will never automatically retry. It will only retry if the message is rejected with a TTL. This is useful if you want to retry the message manually with a custom TTL. To do this, you should use the RejectWithRetry function.

