title: Refresh stored webclients configurations in Map of Fluxes
body: <p>I have a big struggle on my side and maybe someone, somehow know the answer or at least a lead to hang into :D To the point - I have an environment on spring boot where i store Fluxes of defined webclients (that connects to different hosts ) in a map at the to connect to and get data. If someone from the front-end side asks for the same source of data, i return data from the cache instead of creating a new webclient instance :)</p>
  <p>It woks like a charm, but everything collapses when ip/port is changed on the instance - then users cannot get data from the stored webclient because it point's to a invalid connection :( . I've thought about several solutions to the problem:</p>
  <ul>
  <li>Detect no active subscribers and delete it from the map</li>
  <li>Schedule a cleanup action to remove old unused / failed fluxes</li>
  <li>Define action in back propagation mechanism to swap connection
  details</li>
  </ul>
  <p>In code below I have put a definition of cache manager.</p>
  <p>I would be very grateful for any kind of help or advice how to handle this hard cookie :D</p>
  <pre><code>public abstract class CachedFluxReactiveManager&lt;T, M extends FiltreableCommand&gt; extends CachedReactiveManager&lt;T, M, Flux&lt;T&gt;&gt; {
  protected final Map&lt;ReactiveCallsKey, Flux&lt;T&gt;&gt; connections = new ConcurrentHashMap&lt;&gt;();
  protected final FluxClientCreator&lt;T&gt; clientCreator;
  protected final InstancesQueryCreator queryCreator;
  private final boolean useCache;
  
  protected CachedFluxReactiveManager(InstancesCache instancesCache, FluxClientCreator&lt;T&gt; clientCreator,
          InstancesQueryCreator queryCreator, boolean useCache) {
      super(instancesCache);
      this.clientCreator = clientCreator;
      this.queryCreator = queryCreator;
      this.useCache = useCache;
  }
  
  @Override
  public Flux&lt;T&gt; getData(M command) {
  
      if (useCache) {
          if (command.isFiltered()) {
              return createAndReturnConnection(command).next().flux();
          }
  
          return ofNullable(getConnectionIfExists(command))
                  .orElseGet(() -&gt; createAndReturnConnection(command));
      } else {
          return createAndReturnConnection(command);
      }
  }
  
  @Override
  protected Flux&lt;T&gt; getConnectionIfExists(M command) {
      return connections.get(
              getReactiveCallsKey(command.getApplicationName(), command.getTicker(), command.getReferenceEx()));
  }}```
  </code></pre>