redis

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: 4 Imported by: 0

Documentation

Overview

Package redis publishes outbox events to Redis Streams (durable, default) or Redis Pub/Sub (fire-and-forget). Works with standalone, Sentinel and Cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Mode Mode
	// DefaultStream is used when Event.Topic is empty.
	DefaultStream string
	// Prefix is prepended to every stream/channel name.
	Prefix string
	// MaxLen caps streams approximately (XADD MAXLEN ~). Zero means unbounded.
	MaxLen int64
}

Config configures the publisher.

type Mode

type Mode int

Mode selects the Redis primitive.

const (
	// Stream appends to a stream with XADD (recommended; consumer groups get at-least-once).
	Stream Mode = iota
	// PubSub uses PUBLISH. Subscribers that are offline miss messages.
	PubSub
)

type Publisher

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

Publisher implements xoutbox.BatchPublisher.

func New

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 sends all commands in a single pipeline round trip.

Jump to

Keyboard shortcuts

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