rabbitmq

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package rabbitmq publishes outbox events to RabbitMQ with publisher confirms, persistent delivery and automatic reconnection.

Unroutable messages are confirmed by the broker and silently dropped; configure an alternate-exchange on your exchange if that matters for you.

Index

Constants

This section is empty.

Variables

View Source
var ErrNack = errors.New("rabbitmq: message nacked by broker")

ErrNack is returned when the broker negatively acknowledges a message.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL string
	// Exchange to publish to. Empty means the default exchange, where Event.Topic
	// is the destination queue name. Otherwise Event.Topic is the routing key.
	Exchange string
	// DefaultRoutingKey is used when Event.Topic is empty.
	DefaultRoutingKey string
	// AMQP optionally customises the connection (TLS, heartbeat, ...).
	AMQP *amqp.Config
}

Config configures the publisher.

type Publisher

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

Publisher implements xoutbox.BatchPublisher. Safe for concurrent use.

func New

func New(cfg Config) (*Publisher, error)

New dials the broker and opens a confirm-mode channel.

func (*Publisher) Close

func (p *Publisher) Close() error

Close closes the channel and connection.

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, e xoutbox.Event) error

func (*Publisher) PublishBatch

func (p *Publisher) PublishBatch(ctx context.Context, events []xoutbox.Event) []error

PublishBatch publishes all messages, then waits for every confirm.

Jump to

Keyboard shortcuts

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