rabbit

package
v1.0.7883-c047114 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package rabbit contains an experimental RabbitMQ publishing client.

Index

Constants

View Source
const JSON = "application/json; charset=utf-8"

JSON contains the MIME content type for a JSON payload.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	URL            secret.String
	ConnectionName string
	QueueName      string
}

type PublisherPool

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

func Load

func Load(ctx context.Context, cfg Config, sys *system.System) (*PublisherPool, error)

func NewPublisherPool

func NewPublisherPool(ctx context.Context, name string, dialer *amqpextra.Dialer,
	opts ...publisher.Option) *PublisherPool

func (*PublisherPool) Close

func (p *PublisherPool) Close(ctx context.Context) (err error)

Close frees the resources of the PublisherPool

func (*PublisherPool) Gauges

func (p *PublisherPool) Gauges(_ context.Context) map[string]float64

Gauges returns internal measures of the health of the PublisherPool

func (*PublisherPool) MetricName

func (p *PublisherPool) MetricName() string

MetricName returns the name of the PublisherPool

func (*PublisherPool) Publish

func (p *PublisherPool) Publish(ctx context.Context, msg publisher.Message) (err error)

Publish allows the publication of a message with mandatory routing. This should be your preferred option over PublishOptional

func (*PublisherPool) PublishJSON

func (p *PublisherPool) PublishJSON(ctx context.Context, msg publisher.Message, v interface{}) (err error)

PublishJSON allows the publication of a JSON message with mandatory routing. This should be your preferred option over PublishJSONOptional

func (*PublisherPool) PublishJSONOptional

func (p *PublisherPool) PublishJSONOptional(ctx context.Context, msg publisher.Message, v interface{}) (err error)

PublishJSONOptional allows the publication of a message without mandatory routing. This is useful when the message is not already being consumed. _You should prefer PublishJSON, which has mandatory routing forced, and should_ _move to mandatory routing once you confirm your message is indeed consumed._

func (*PublisherPool) PublishOptional

func (p *PublisherPool) PublishOptional(ctx context.Context, msg publisher.Message) (err error)

PublishOptional allows the publication of a message without mandatory routing. This is useful when the message is not already being consumed. _You should prefer Publish, which has mandatory routing forced, and should_ _move to mandatory routing once you confirm your message is indeed consumed._

Jump to

Keyboard shortcuts

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