rabbitmq

package
v0.0.0-...-5e165d6 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2023 License: MIT Imports: 6 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 {
	Schema               string
	Username             string
	Password             string
	Host                 string
	Port                 int
	Vhost                string
	ConnectionName       string
	ChannelNotifyTimeout time.Duration
	Reconnect            struct {
		Interval   time.Duration
		MaxAttempt int
	}
}

type RabbitMQ

type RabbitMQ struct {
	ChannelNotifyTimeout time.Duration
	// contains filtered or unexported fields
}

func New

func New(config Config) (*RabbitMQ, error)

func (*RabbitMQ) Channel

func (r *RabbitMQ) Channel() (*amqp.Channel, error)

Channel returns a new `*amqp.Channel` instance. You must call `defer channel.Close()` as soon as you obtain one. Sometimes the connection might be closed unintentionally so as a graceful handling, try to connect only once.

func (*RabbitMQ) Connect

func (r *RabbitMQ) Connect() error

Connect creates a new connection. Use once at application startup.

func (*RabbitMQ) Connection

func (r *RabbitMQ) Connection() *amqp.Connection

Connection exposes the essentials of the current connection. You should not normally use this but it is there for special use cases.

func (*RabbitMQ) Shutdown

func (r *RabbitMQ) Shutdown() error

Shutdown triggers a normal shutdown. Use this when you wish to shutdown your current connection or if you are shutting down the application.

Jump to

Keyboard shortcuts

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