Interface FlagChangeListener


  • public interface FlagChangeListener
    An event listener that is notified when a feature flag's configuration has changed.

    As described in FlagTracker.addFlagChangeListener(FlagChangeListener), this notification does not mean that the flag now returns a different value for any particular user, only that it may do so. LaunchDarkly feature flags can be configured to return a single value for all users, or to have complex targeting behavior. To know what effect the change would have for any given set of user properties, you would need to re-evaluate the flag by calling one of the variation methods on the client.

    
         FlagChangeListener listenForChanges = event -> {
             System.out.println("a flag has changed: " + event.getKey());
         };
         client.getFlagTracker().addFlagChangeListener(listenForChanges);
     
    In simple use cases where you know that the flag configuration does not vary per user, or where you know ahead of time what user properties you will evaluate the flag with, it may be more convenient to use FlagValueChangeListener.
    Since:
    5.0.0
    See Also:
    FlagValueChangeListener, FlagTracker.addFlagChangeListener(FlagChangeListener), FlagTracker.removeFlagChangeListener(FlagChangeListener)
    • Method Detail

      • onFlagChange

        void onFlagChange​(FlagChangeEvent event)
        The SDK calls this method when a feature flag's configuration has changed in some way.
        Parameters:
        event - the event parameters