public void Configure(IConfiguration configuration, IClientBuilder clientBuilder) { var clusterConnectionLostNotifier = new EventNotifier <EventArgs>(); var gatewayConnectionCountNotifier = new EventNotifier <GatewayCountChangedEventArgs>(); clientBuilder.ConfigureServices(s => s.AddSingleton(clusterConnectionLostNotifier)); clientBuilder.ConfigureServices(s => s.AddSingleton(gatewayConnectionCountNotifier)); clientBuilder.Configure <GatewayOptions>(options => options.GatewayListRefreshPeriod = TimeSpan.FromSeconds(1)); clientBuilder.AddClusterConnectionLostHandler((s, e) => clusterConnectionLostNotifier.Notify(e)); clientBuilder.AddGatewayCountChangedHandler((s, e) => gatewayConnectionCountNotifier.Notify(e)); }