connection

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(r *Redialer)

Option to configure Reconnector.

func WithBackoff

func WithBackoff(bo backoff.BackOff) Option

WithBackoff sets backoff function for reconnection. By default, uses backoff.NewExponentialBackOff.

func WithConfig

func WithConfig(cfg amqp.Config) Option

WithConfig uses provided cfg to specify a configuration for the transport and connection setup used during a connection open handshake. See more: https://pkg.go.dev/github.com/rabbitmq/amqp091-go@v1.8.0#DialConfig.

func WithDialAttemptCallback

func WithDialAttemptCallback(fn func(error)) Option

WithDialAttemptCallback registers a callback for any AMQP dial attempt result. Will call func with result for each attempt to dial AMQP.

func WithDialledCallback

func WithDialledCallback(fn func(*amqp.Connection)) Option

WithDialledCallback registers a callback for successful AMQP dial. Will call func with each created connection. Could be used to set up listeners for various evens (NotifyClose, NotifyFlow, etc.) after channel recreation.

type Redialer

type Redialer struct {
	*amqp.Connection
	// contains filtered or unexported fields
}

Redialer wraps connection to add re-dial capabilities. All methods of the regular channel are also available.

func Dial

func Dial(url string, ops ...Option) (*Redialer, error)

Dial is a regular amqp.Dial with re-dialing and backoff.

func (*Redialer) Channel

func (r *Redialer) Channel(ops ...channel.Option) (*channel.Reopener, error)

Channel create new channel.Reopener with channel re-open capabilities. Will re-dial if connection is closed. Access original channel with r.Connection.Channel().

Jump to

Keyboard shortcuts

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