messagequeue

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package messagequeue provides message queue publisher and consumer interfaces with implementations for Google Pub/Sub, Redis, and Amazon SQS.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyTopicName is returned when a topic name is empty.
	ErrEmptyTopicName = platformerrors.New("empty topic name")
)

Functions

This section is empty.

Types

type Consumer

type Consumer interface {
	Consume(ctx context.Context, stopChan chan bool, errors chan error)
}

Consumer produces events onto a queue.

type ConsumerFunc

type ConsumerFunc func(context.Context, []byte) error

ConsumerFunc is a function type that handles consumed messages.

type ConsumerProvider

type ConsumerProvider interface {
	ProvideConsumer(ctx context.Context, topic string, handlerFunc ConsumerFunc) (Consumer, error)
}

ConsumerProvider is a function that provides a Consumer for a given topic.

type Publisher

type Publisher interface {
	// Stop halts all publishing.
	Stop()
	// Publish writes a message onto a message queue.
	Publish(ctx context.Context, data any) error
	// PublishAsync writes a message onto a message queue, but logs any encountered errors instead of returning them.
	PublishAsync(ctx context.Context, data any)
}

Publisher produces events onto a queue.

type PublisherProvider

type PublisherProvider interface {
	Close()
	Ping(ctx context.Context) error
	ProvidePublisher(ctx context.Context, topic string) (Publisher, error)
}

PublisherProvider is a function that provides a Publisher for a given topic.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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