rabbit

package
v0.0.0-...-4c7982d Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeclareExchange

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

DeclareExchange creates exchange to publish events

func DeclareQueue

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

DeclareQueue decrares durable queue

func NewChannel

func NewChannel(ch *amqp.Channel, qName string) (<-chan amqp.Delivery, error)

NewChannel creates channel to listen from rabbit with auto ack = false

Types

type ChannelProvider

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

ChannelProvider provider amqp channel

func NewChannelProvider

func NewChannelProvider() (*ChannelProvider, error)

NewChannelProvider initializes channel provider

func (*ChannelProvider) Channel

func (pr *ChannelProvider) Channel() (*amqp.Channel, error)

Channel return cached channel or tries to connect to rabbit broker

func (*ChannelProvider) Close

func (pr *ChannelProvider) Close()

Close finalizes ChannelProvider

func (*ChannelProvider) Healthy

func (pr *ChannelProvider) Healthy() error

Healthy checks if rabbit channel is open

func (*ChannelProvider) QueueName

func (pr *ChannelProvider) QueueName(name string) string

QueueName return queue name for channel, may append prefix

func (*ChannelProvider) RunOnChannelWithRetry

func (pr *ChannelProvider) RunOnChannelWithRetry(f runOnChannelFunc) error

RunOnChannelWithRetry invokes method on channel with retry

type Publisher

type Publisher struct {
	ChannelProvider *ChannelProvider
}

Publisher publish events to rabbit mq broker

func NewPublisher

func NewPublisher(provider *ChannelProvider) *Publisher

NewPublisher initializes rabbit publisher

func (*Publisher) Publish

func (sender *Publisher) Publish(id string, topic string) error

Publish publish the message

type Sender

type Sender struct {
	ChannelProvider *ChannelProvider
}

Sender performs messages sending using rabbit mq broker

func NewSender

func NewSender(provider *ChannelProvider) *Sender

NewSender initializes rabbit sender

func (*Sender) Send

func (sender *Sender) Send(message messages.Message, queue string, replyQueue string) error

Send sends the message

func (*Sender) SendWithCorr

func (sender *Sender) SendWithCorr(message messages.Message, queue string, replyQueue string, corrID string) error

SendWithCorr sends the message with correlationID

Jump to

Keyboard shortcuts

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