Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Binding ¶
type Binding struct { Exchange string `mapstructure:"exchange"` RoutingKeys []string `mapstructure:"routing_keys"` Options Options `mapstructure:"options"` }
Binding describe how a queue connects to a exchange.
type Config ¶
type Config struct { Connections map[string]Connection `mapstructure:"connections"` Consumers Consumers `mapstructure:"consumers"` Exchanges Exchanges `mapstructure:"exchanges"` }
Config describes all available options for amqp connection creation.
type Connection ¶
type Connection struct { DSN string `mapstructure:"dsn"` ReconnectDelay time.Duration `mapstructure:"reconnect_delay"` }
Connection describe a config for one connection.
type Connections ¶
type Connections map[string]Connection
Connections describe the connections used by consumers.
type ConsumerConfig ¶
type ConsumerConfig struct { Connection string `mapstructure:"connection"` Workers int `mapstructure:"workers"` PrefetchCount int `mapstructure:"prefetch_count"` PrefetchSize int `mapstructure:"prefetch_size"` Queue QueueConfig `mapstructure:"queue"` Options Options `mapstructure:"options"` Runner runner.Config `mapstructure:"runner"` }
ConsumerConfig describes consumer's configuration.
type Consumers ¶
type Consumers map[string]ConsumerConfig
Consumers describes configuration list for consumers.
type DeliveryMode ¶
type DeliveryMode int
DeliveryMode describes an AMQP message delivery mode.
const ( NonPersistent DeliveryMode = 1 Persistent = 2 )
List of available values for `delivery_mode` producer option.
type ExchangeConfig ¶
type ExchangeConfig struct { Type string `mapstructure:"type"` Options Options `mapstructure:"options"` }
ExchangeConfig describes exchange's configuration.
type Exchanges ¶
type Exchanges map[string]ExchangeConfig
Exchanges all the exchanges used by consumer. This exchanges are declared on startup of the rabbitMQ factory.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory is the block responsible for create consumers and restart the rabbitMQ connections.
func NewFactory ¶
NewFactory will open the initial connections and start the recover connections procedure.
func (*Factory) CreateConsumer ¶
func (f *Factory) CreateConsumer(name string) (supervisor.Consumer, error)
CreateConsumer create a new consumer for a specific name using the config provided.
func (*Factory) CreateConsumers ¶
func (f *Factory) CreateConsumers() ([]supervisor.Consumer, error)
CreateConsumers will iterate over config and create all the consumers
type Options ¶
type Options struct { Durable bool `mapstructure:"durable"` Internal bool `mapstructure:"internal"` AutoDelete bool `mapstructure:"auto_delete"` Exclusive bool `mapstructure:"exclusive"` NoWait bool `mapstructure:"no_wait"` NoLocal bool `mapstructure:"no_local"` AutoAck bool `mapstructure:"auto_ack"` Args amqp.Table `mapstructure:"args"` }
Options describes optionals configuration for consumer, queue, bindings and exchanges.
type QueueConfig ¶
type QueueConfig struct { Name string `mapstructure:"name"` Bindings []Binding `mapstructure:"bindings"` Options Options `mapstructure:"options"` }
QueueConfig describes queue's configuration.