rabbitmq

package
v0.98.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_RETRY_COUNT = 15
View Source
const PUB_ACQUIRE_CHANNEL_RETRIES = 3
View Source
const RETRY_INTERVAL = 2 * time.Second
View Source
const RETRY_RESET_INTERVAL = 30 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageQueueImpl

type MessageQueueImpl struct {
	// contains filtered or unexported fields
}

MessageQueueImpl implements MessageQueue interface using AMQP.

func New

func New(fs ...MessageQueueImplOpt) (func() error, *MessageQueueImpl, error)

New creates a new MessageQueueImpl.

func (*MessageQueueImpl) Clone

func (t *MessageQueueImpl) Clone() (func() error, msgqueue.MessageQueue, error)

func (*MessageQueueImpl) IsReady

func (t *MessageQueueImpl) IsReady() bool

func (*MessageQueueImpl) SendMessage added in v0.74.3

func (t *MessageQueueImpl) SendMessage(ctx context.Context, q msgqueue.Queue, msg *msgqueue.Message) error

func (*MessageQueueImpl) SetQOS

func (t *MessageQueueImpl) SetQOS(prefetchCount int)

func (*MessageQueueImpl) Subscribe

func (t *MessageQueueImpl) Subscribe(
	q msgqueue.Queue,
	preAck msgqueue.MsgHandler,
	postAck msgqueue.MsgHandler,
) (func() error, error)

Subscribe subscribes to the msg queue.

type MessageQueueImplOpt

type MessageQueueImplOpt func(*MessageQueueImplOpts)

func WithDeadLetterBackoff added in v0.74.3

func WithDeadLetterBackoff(backoff time.Duration) MessageQueueImplOpt

func WithGzipCompression added in v0.74.3

func WithGzipCompression(enabled bool, threshold int) MessageQueueImplOpt

func WithLogger

func WithLogger(l *zerolog.Logger) MessageQueueImplOpt

func WithMaxPubChannels added in v0.74.3

func WithMaxPubChannels(maxConns int32) MessageQueueImplOpt

func WithMaxSubChannels added in v0.74.3

func WithMaxSubChannels(maxConns int32) MessageQueueImplOpt

func WithMessageRejection added in v0.73.46

func WithMessageRejection(enabled bool, maxDeathCount int) MessageQueueImplOpt

func WithQos

func WithQos(qos int) MessageQueueImplOpt

func WithURL

func WithURL(url string) MessageQueueImplOpt

type MessageQueueImplOpts

type MessageQueueImplOpts struct {
	// contains filtered or unexported fields
}

type PubSub added in v0.98.9

type PubSub struct {
	// contains filtered or unexported fields
}

PubSub implements msgqueue.PubSub over RabbitMQ. Tenant topics map to the legacy per-tenant fanout exchanges ("<uuid>_v1") and scheduler partition topics map to the scheduler's exclusive queue on the default exchange, so mixed-version fleets interoperate.

INVARIANT: the PubSub owns its AMQP connections and channel pools and never shares them with the durable MessageQueueImpl, since Pub can be called from within durable-write paths.

func NewPubSub added in v0.98.9

func NewPubSub(fs ...PubSubOpt) (func() error, *PubSub, error)

NewPubSub creates a new RabbitMQ-backed PubSub with its own connections and channel pools.

func (*PubSub) IsReady added in v0.98.9

func (p *PubSub) IsReady() bool

func (*PubSub) Pub added in v0.98.9

func (p *PubSub) Pub(ctx context.Context, topic msgqueue.Topic, msg *msgqueue.Message) error

Pub publishes a message to the topic. Delivery is best-effort and non-persistent: if no subscriber queue is bound, the message is dropped.

func (*PubSub) Sub added in v0.98.9

func (p *PubSub) Sub(topic msgqueue.Topic, handler msgqueue.MsgHandler) (func() error, error)

Sub subscribes to a topic. Delivery is at-most-once: messages are acked before the handler runs, and handler errors are logged, never redelivered.

type PubSubOpt added in v0.98.9

type PubSubOpt func(*PubSubOpts)

func WithPubSubGzip added in v0.98.9

func WithPubSubGzip(enabled bool, threshold int) PubSubOpt

WithPubSubGzip enables gzip compression of payloads. Compression settings must match the durable MessageQueue's settings for wire compatibility, since both sides publish to the same tenant exchanges in mixed-version fleets.

func WithPubSubLogger added in v0.98.9

func WithPubSubLogger(l *zerolog.Logger) PubSubOpt

func WithPubSubMaxPubChannels added in v0.98.9

func WithPubSubMaxPubChannels(maxChannels int32) PubSubOpt

func WithPubSubMaxSubChannels added in v0.98.9

func WithPubSubMaxSubChannels(maxChannels int32) PubSubOpt

func WithPubSubURL added in v0.98.9

func WithPubSubURL(url string) PubSubOpt

type PubSubOpts added in v0.98.9

type PubSubOpts struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL