Skip to content

2.8.0 - Added support for lame duck mode notification

Compare
Choose a tag to compare
@RichardHightower RichardHightower released this 24 Aug 17:19
031b245
  • 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.