amqpextra
amqpextra copied to clipboard
Dialer pool.
Maintain several connections to different RabbitMQ servers under the hood. Serve to clients only healthy connections. Exclude unhealthy until recovered.
package main
import (
"github.com/makasim/amqpextra"
"github.com/makasim/amqpextra/publisher"
)
func main() {
d1, _ := amqpextra.NewDialer(
amqpextra.WithURL("amqp://guest:guest@foo-rabbitmq:5672/"),
)
d2, _ := amqpextra.NewDialer(
amqpextra.WithURL("amqp://guest:guest@bar-rabbitmq2:5672/"),
)
connCh := amqpextra.NewDialerPool(d1, d2)
p, _ := amqpextra.NewPublisher(connCh)
p.Publish(publisher.Message{
Exchange: "foo",
})
}
fixes https://github.com/makasim/amqpextra/issues/48
TODO:
- [ ] tests
- [ ] doc