Reconnect AMQP consumer to broker (#3947)
This commit is contained in:
parent
352e99c890
commit
df0bded83e
|
@ -145,9 +145,10 @@ func (a *AMQPConsumer) Start(acc telegraf.Accumulator) error {
|
|||
go a.process(msgs, acc)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
err := <-a.conn.NotifyClose(make(chan *amqp.Error))
|
||||
if err == nil {
|
||||
return
|
||||
break
|
||||
}
|
||||
|
||||
log.Printf("I! AMQP consumer connection closed: %s; trying to reconnect", err)
|
||||
|
@ -163,6 +164,7 @@ func (a *AMQPConsumer) Start(acc telegraf.Accumulator) error {
|
|||
go a.process(msgs, acc)
|
||||
break
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue