NATS client v2.8.0 Release Notes
Release Date: 2020-08-24 // over 3 years ago-
- ➕ Added lame-duck mode support 334
When a server goes into lame-duck mode. The client will send out a connection event.
Example code registering for lame-duck mode.
Options options = new Options.Builder().server(ts.getURI()).connectionListener(new ConnectionListener() { @Overridepublic void connectionEvent(Connection conn, Events type) { if (type.equals(Events.LAME\_DUCK)) connectLDM.complete(type); } }).build(); Connection nc = Nats.connect(options);
Lame-duck mode is for servers in a cluster to tell clients that they will no longer be serving requests.
Clients can get notified of this and gracefully perform some actions.