- 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() {
@Override
public 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.