streadway/amqp Connection/Channel does not reconnect if rabbitmq server restart/down.
To simply developers, here is auto reconnect wrap with detail comments.
- add import
import "github.com/isayme/go-amqp-reconnect/rabbitmq"
- Replace
amqp.Connection
/amqp.Channel
withrabbitmq.Connection
/rabbitmq.Channel
!
go run example/close/demo.go
go run example/reconnect/demo.go