rabbit

package
v0.0.0-...-b784279 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consumer

type Consumer struct {
	Rabbit *Rabbit
	// contains filtered or unexported fields
}

func NewConsumer

func NewConsumer(config ConsumerConfig, rabbit *Rabbit) *Consumer

NewConsumer returns a consumer instance.

func (*Consumer) Start

func (c *Consumer) Start() error

Start declares all the necessary components of the consumer and runs the consumers. This is called one at the application start up or when consumer needs to reconnects to the server.

type ConsumerConfig

type ConsumerConfig struct {
	ExchangeName  string
	ExchangeType  string
	RoutingKey    string
	QueueName     string
	ConsumerName  string
	ConsumerCount int
	PrefetchCount int
	Reconnect     struct {
		MaxAttempt int
		Interval   time.Duration
	}
}

type Rabbit

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

func NewRabbit

func NewRabbit(config RabbitMQConfig) *Rabbit

NewRabbit returns a RabbitMQ instance.

func (*Rabbit) Channel

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

Channel returns a new `*amqp.Channel` instance.

func (*Rabbit) Connect

func (r *Rabbit) Connect() error

Connect connects to RabbitMQ server.

func (*Rabbit) Connection

func (r *Rabbit) Connection() (*amqp.Connection, error)

Connection returns exiting `*amqp.Connection` instance.

type RabbitMQConfig

type RabbitMQConfig struct {
	Schema         string
	Username       string
	Password       string
	Host           string
	Port           string
	VHost          string
	ConnectionName string
}

Jump to

Keyboard shortcuts

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