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 describe the connections used by consumers. Connections map[string]Connection `mapstructure:"connections" default:"{}"` // Exchanges have all the exchanges used by consumers. // This exchanges are declared on startup of the rabbitMQ factory. Exchanges map[string]ExchangeConfig `mapstructure:"exchanges" default:"{}"` // DeadLetters have all the deadletters queues used internally by other queues // This will be declared at startup of the rabbitMQ factory DeadLetters map[string]DeadLetter `mapstructure:"dead_letters" default:"{}"` // Consumers describes configuration list for consumers. Consumers map[string]ConsumerConfig `mapstructure:"consumers" default:"{}"` //Versioning internal config - used to mount the user agents Version string }
Config describes all available options for amqp connection creation.
type Connection ¶
type Connection struct { DSN string `mapstructure:"dsn"` Timeout time.Duration `mapstructure:"timeout" default:"2s"` Sleep time.Duration `mapstructure:"sleep" default:"500ms"` Retries int `mapstructure:"retries" default:"5"` }
Connection describe a config for one connection.
type ConsumerConfig ¶
type ConsumerConfig struct { Connection string `mapstructure:"connection"` MaxWorkers int `mapstructure:"workers" default:"1"` PrefetchCount int `mapstructure:"prefetch_count" default:"10"` DeadLetter string `mapstructure:"dead_letter"` Queue QueueConfig `mapstructure:"queue"` Options Options `mapstructure:"options"` Runner runner.Config `mapstructure:"runner"` }
ConsumerConfig describes consumer's configuration.
type DeadLetter ¶ added in v0.1.2
type DeadLetter struct {
Queue QueueConfig `mapstructure:"queue"`
}
DeadLetter describe all the dead letters queues to be declared before declare other queues.
type ExchangeConfig ¶
type ExchangeConfig struct { Type string `mapstructure:"type"` Options Options `mapstructure:"options"` }
ExchangeConfig describes exchange's configuration.
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" default:"{}"` }
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.