Fix NATS plug-ins reconnection logic (#1955)

* NATS output plug-in now retries to reconnect forever after a lost connection.

* NATS input plug-in now retries to reconnect forever after a lost connection.

* Fixes #1953
This commit is contained in:
Paulo Pires
2016-10-26 10:45:33 -04:00
committed by Cameron Sparr
parent b1a97e35b9
commit 522658bd07
3 changed files with 18 additions and 1 deletions

View File

@@ -91,8 +91,15 @@ func (n *natsConsumer) Start(acc telegraf.Accumulator) error {
var connectErr error
// set default NATS connection options
opts := nats.DefaultOptions
// override max reconnection tries
opts.MaxReconnect = -1
// override servers if any were specified
opts.Servers = n.Servers
opts.Secure = n.Secure
if n.Conn == nil || n.Conn.IsClosed() {