Skip to content

Commit

Permalink
Add more defaultNatsOptions and change log msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
imperiuse committed Feb 17, 2021
1 parent e269347 commit 0a1829d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions nats/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,16 @@ func (c *client) defaultNatsOptions() []Option {
nats.ReconnectJitter(ReconnectJitterDefault, ReconnectJitterTLSDefault),
nats.ReconnectWait(ReconnectWaitDefault),
nats.DisconnectErrHandler(func(nc *nats.Conn, err error) {
c.log.Warn("Got disconnected", zap.Error(err))
c.log.Warn("[DisconnectErrHandler] Disconnect", zap.Error(err))
}),
nats.ReconnectHandler(func(nc *nats.Conn) {
c.log.Warn("Got reconnected", zap.String("ConnUrl", nc.ConnectedUrl()))
c.log.Warn("[ReconnectHandler] Reconnect", zap.String("ConnUrl", nc.ConnectedUrl()))
}),
nats.ClosedHandler(func(nc *nats.Conn) {
c.log.Warn("Connection closed", zap.Error(nc.LastError()))
c.log.Warn("[ClosedHandler] Close handler", zap.Error(nc.LastError()))
}),
nats.ErrorHandler(func(_ *nats.Conn, _ *nats.Subscription, err error) {
c.log.Warn("[ErrorHandler]", zap.Error(err))
}),
}
}
Expand Down

0 comments on commit 0a1829d

Please sign in to comment.