mq

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package mq containts helper functions to make the work with RabbitMQ easier.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Consume

func Consume(ch *amqp091.Channel, name string, handle chan<- event.InternalEvent)

Consume consumes events from the queue with the specified name. It will wait forever for new events until the program shuts down. After consuming, the event will be forwarded to the handle channel.

Panics if the queue cannot be consumed.

func DeclareTopology

func DeclareTopology(ch *amqp091.Channel) error

DeclareTopology declares the hub topic exchange and two queues: gate and core. After declaring the queues, they are bound to the exchange, which serves as the event bus for all events in the system.

The gate queue is consumed by the core server, and the gatekeeper will publish incomming client events to it. The core queue is consumed by the gatekeeper, and the core server will publish server events to it.

Do not call this function from the core server, since it's a gatekeeper's responsibility to manage the lifecycle of queues and the exchange.

func Publish

func Publish(ch *amqp091.Channel, name string, raw []byte)

Publish publishes an event to the queue with the specified name via the specified channel. It waits up to 5 seconds for the event to be published; otherwise, an error is logged.

Types

This section is empty.

Jump to

Keyboard shortcuts

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