amqp

package
v4.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Configures the AMQP delivery to deliver notifications directly to
	// the configured Exchange.
	//
	// If true "Callback" is ignored.
	// If false a notifier.Callback is delivered to the queue and clients
	// utilize the pagination API to retrieve.
	Direct bool
	// Specifies the number of notifications delivered in single AMQP message
	// when Direct is true.
	//
	// Ignored if Direct is not true
	// If 0 or 1 is provided no rollup occurs and each notification is delivered
	// separately.
	Rollup int
	// The AMQP exchange notifications will be delivered to.
	// A passive declare is performed and if the exchange does not exist
	// the declare will fail.
	Exchange Exchange `yaml:"exchange"`
	// The routing key used to route notifications to the desired queue.
	RoutingKey string `yaml:"routing_key"`
	// The callback url where notifications are retrieved.
	Callback string

	// A list of AMQP compliant URI scheme. see: https://www.rabbitmq.com/uri-spec.html
	// example: "amqp://user:pass@host:10000/vhost"
	//
	// The first successful connection will be used by the amqp deliverer.
	//
	// If "amqps://" broker URI schemas are provided the TLS configuration below is required.
	URIs []string `yaml:"uris"`
	TLS  *TLS     `yaml:"tls"`
	// contains filtered or unexported fields
}

Config provides configuration for an AMQP deliverer.

func (*Config) Validate

func (c *Config) Validate() (Config, error)

Validate confirms configuration is valid and fills in private members with parsed values on success.

type Deliverer

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

Deliverer is an AMQP deliverer which publishes a notifier.Callback to the the broker.

It's an error to configure this deliverer with an Exchange that does not exist. Administrators should configure the Exchange, Queue, and Bindings before starting this deliverer.

func New

func New(conf Config) (*Deliverer, error)

func (*Deliverer) Deliver

func (d *Deliverer) Deliver(ctx context.Context, nID uuid.UUID) error

func (*Deliverer) Name

func (d *Deliverer) Name() string

type DirectDeliverer

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

DirectDeliverer is an AMQP deliverer which publishes notifications directly to the broker.

It's an error to configure this deliverer with an exchange that does not exist. Administrators should configure the Exchange, Queue, and Bindings before starting this deliverer.

func NewDirectDeliverer

func NewDirectDeliverer(conf Config) (*DirectDeliverer, error)

func (*DirectDeliverer) Deliver

func (d *DirectDeliverer) Deliver(ctx context.Context, _ uuid.UUID) error

func (*DirectDeliverer) Name

func (d *DirectDeliverer) Name() string

func (*DirectDeliverer) Notifications

func (d *DirectDeliverer) Notifications(ctx context.Context, n []notifier.Notification) error

Notifications will copy the provided notifications into a buffer for AMQP delivery.

type Exchange

type Exchange struct {
	// The name of the exchange
	Name string `yaml:"name"`
	// The type of the exchange. Typically:
	// "direct"
	// "fanout"
	// "topic"
	// "headers"
	Type string `yaml:"type"`
	// Whether the exchange survives server restarts
	Durable bool `yaml:"durability"`
	// Whether bound consumers define the lifecycle of the Exchange.
	AutoDelete bool `yaml:"auto_delete"`
}

Exchange are the required fields necessary to check the existence of an Exchange

For more details see: https://godoc.org/github.com/streadway/amqp#Channel.ExchangeDeclarePassive

type TLS

type TLS struct {
	// The filesystem path where a root CA can be read.
	RootCA string `yaml:"root_ca"`
	// The filesystem path where a tls certificate can be read.
	Cert string `yaml:"cert"`
	// The filesystem path where a tls private key can be read.
	Key string `yaml:"key"`
}

Jump to

Keyboard shortcuts

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