Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Addr = flag.String("amqp-addr", "", "the amqp addr") Password = flag.String("amqp-password", "", "the amqp password") Username = flag.String("amqp-username", "", "the amqp username") )
Flags
Functions ¶
This section is empty.
Types ¶
type AMQP ¶
type AMQP struct {
// contains filtered or unexported fields
}
AMQP represents a client capable of sending/listening to AMQP queues
func New ¶
func New(c Configuration) (a *AMQP)
New creates a new AMQP instance based on a configuration
func (*AMQP) AddConsumer ¶
func (a *AMQP) AddConsumer(c ConfigurationConsumer) (err error)
AddConsumer adds a consumer
func (*AMQP) AddProducer ¶
func (a *AMQP) AddProducer(c ConfigurationProducer) (p *Producer, err error)
AddProducer adds a producer
type Acknowledger ¶
type Acknowledger interface {
Ack(multiple bool) error
Nack(multiple bool, requeue bool) error
Reject(requeue bool) error
}
Acknowledger represents an acknowledger
type Configuration ¶
type Configuration struct {
Addr string `toml:"addr"`
Password string `toml:"password"`
QOS *ConfigurationQOS `toml:"qos"`
Username string `toml:"username"`
}
Configuration represents the AMQP configuration
type ConfigurationConsumer ¶
type ConfigurationConsumer struct {
Arguments Table
AutoAck bool
Exchange ConfigurationExchange
Exclusive bool
Handler Handler
NoLocal bool
NoWait bool
Queue ConfigurationQueue
RoutingKey string
}
ConfigurationConsumer represents a consumer configuration
type ConfigurationExchange ¶
type ConfigurationExchange struct {
Arguments Table
AutoDeleted bool
Durable bool
Internal bool
Name string
NoWait bool
Type ExchangeType
}
ConfigurationExchange represents an exchange configuration
type ConfigurationProducer ¶
type ConfigurationProducer struct {
Exchange ConfigurationExchange
}
ConfigurationProducer represents a producer configuration
type ConfigurationQOS ¶
type ConfigurationQOS struct {
Global bool `toml:"global"`
PrefetchCount int `toml:"prefetch_count"`
PrefetchSize int `toml:"prefetch_size"`
}
ConfigurationQOS represents the AMQP QOS configuration
type ConfigurationQueue ¶
type ConfigurationQueue struct {
Arguments Table
AutoDeleted bool
Durable bool
Exclusive bool
Name string
NoWait bool
}
ConfigurationQueue represents a queue configuration
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer represents a Consumer
type ExchangeType ¶
type ExchangeType string
ExchangeType represents an exchange type
const ( ExchangeTypeDirect ExchangeType = "direct" ExchangeTypeFanout ExchangeType = "fanout" ExchangeTypeHeaders ExchangeType = "headers" ExchangeTypeTopic ExchangeType = "topic" )
Constants
type Handler ¶
type Handler func(msg []byte, routingKey string, a Acknowledger) error
Handler handles a message