queue

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SIRIUS_RABBITMQ = "amqp://guest:guest@sirius-rabbitmq:5672/"
)

Variables

This section is empty.

Functions

func Listen

func Listen(qName string, messageProcessor MessageProcessor)

Listen listens to a RabbitMQ queue specified by qName and processes messages using the provided messageProcessor function. WARNING: This function calls log.Fatalf on connection failure, killing the entire process. For resilient listening with automatic reconnection, use ListenWithRetry instead.

func ListenWithRetry added in v0.0.14

func ListenWithRetry(ctx context.Context, qName string, messageProcessor MessageProcessor)

ListenWithRetry listens to a RabbitMQ queue with automatic reconnection. Unlike Listen, this function does NOT call log.Fatalf on failure. Instead it retries the connection with exponential backoff (1s → 30s cap) and automatically reconnects if the broker drops the connection. The listener stops cleanly when ctx is cancelled.

func Send

func Send(qName string, message string) error

Send sends a message to a RabbitMQ queue specified by qName.

Types

type MessageProcessor

type MessageProcessor func(msg string)

MessageProcessor is a type for functions that can process messages.

Jump to

Keyboard shortcuts

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