rabbitmq

package
v0.0.0-...-7fb4ca9 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: ISC Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectRabbitMQ

func ConnectRabbitMQ() *amqp.Connection

func Consume

func Consume(ch *amqp.Channel, q amqp.Queue) (<-chan amqp.Delivery, error)

func DeclareExchange

func DeclareExchange(ch *amqp.Channel, name string, kind string) error

func DeclareQueue

func DeclareQueue(ch *amqp.Channel, name string) (amqp.Queue, error)

func OpenChannel

func OpenChannel(conn *amqp.Connection) (*amqp.Channel, error)

func Publish

func Publish(ch *amqp.Channel, exchange string, key string, body RabbitMqBody) error

func QueueBind

func QueueBind(ch *amqp.Channel, q amqp.Queue, key string, exchange string) error

Types

type RabbitMqBody

type RabbitMqBody struct {
	DataVersion string `json:"data_version"`
	Data        any    `json:"data"`
}

type RabbitMqRouter

type RabbitMqRouter struct {
	Channel   *amqp.Channel
	Exchanges map[string]bool
}

func NewRouter

func NewRouter(ch *amqp.Channel) *RabbitMqRouter

func (*RabbitMqRouter) HandleFunc

func (r *RabbitMqRouter) HandleFunc(exchange string, key string, f func(body RabbitMqBody))

func (*RabbitMqRouter) PublishMessage

func (r *RabbitMqRouter) PublishMessage(exchange string, key string, bodies []RabbitMqBody) error

Jump to

Keyboard shortcuts

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