# README
Astiamqp
Wrapper on top of amqp to provide proper configuration and error handling
Usage
// Setup logger
l := log.New(log.Writer(), log.Prefix(), log.Flags())
// Create worker
w := astikit.NewWorker(astikit.WorkerOptions{Logger: l})
// Create amqp
a := astiamqp.New(c, l)
defer a.Close()
// You can create producers before and after starting amqp
p, _ := a.NewProducer(astiamqp.ConfigurationProducer{
Exchange: astiamqp.ConfigurationExchange{
Durable: true,
Name: "my-exchange",
Type: astiamqp.ExchangeTypeTopic,
},
})
// You can add consumers before and after starting amqp
a.AddConsumer(astiamqp.ConfigurationConsumer{
AutoAck: false,
Exchange: astiamqp.ConfigurationExchange{
Durable: true,
Name: "my-exchange",
Type: astiamqp.ExchangeTypeTopic,
},
Handler: myHandler,
Queue: astiamqp.ConfigurationQueue{
Durable: true,
Name: "my-queue",
},
RoutingKey: "my.routing.key",
})
// You can publish messages before and after starting amqp.
// If you publish a message before starting amqp, it will be buffered and will be sent once
// it's connected to the channel
p.Publish("my payload", "my.routing.key")
// Start amqp
a.Start(w)
// Stop amqp
a.Stop()
# Functions
FlagConfig returns an AMQP config based on flags.
New creates a new AMQP instance based on a configuration.
# Constants
Constants.
Constants.
Constants.
Constants.
# Structs
AMQP represents a client capable of sending/listening to AMQP queues.
Configuration represents the AMQP configuration.
ConfigurationConsumer represents a consumer configuration.
ConfigurationExchange represents an exchange configuration.
ConfigurationProducer represents a producer configuration.
ConfigurationQOS represents the AMQP QOS configuration.
ConfigurationQueue represents a queue configuration.
Consumer represents a Consumer.
Producer represents a producer.
# Interfaces
Acknowledger represents an acknowledger.
# Type aliases
ExchangeType represents an exchange type.
Handler handles a message.
Table wraps amqp.Table.