Class StreamingBuilder

java.lang.Object
co.featbit.server.StreamingBuilder
All Implemented Interfaces:
DataSynchronizerFactory

public abstract class StreamingBuilder extends Object implements DataSynchronizerFactory
Factory to create a Streaming implementation By default, the SDK uses a streaming connection to receive feature flag data. If you want to customize the behavior of the connection, create a builder with Factory.dataSynchronizerFactory(), change its properties with the methods of this class, and pass it to FBConfig.Builder.dataSynchronizerFactory(DataSynchronizerFactory):

      StreamingBuilder streamingBuilder = Factory.streamingBuilder()
           .firstRetryDelay(Duration.ofSeconds(1));
       FBConfig config = new FBConfig.Builder()
           .updateProcessorFactory(streamingBuilder)
           .build();
       FBClient client = new FBClientImp(envSecret, config);
 
  • Field Details

    • DEFAULT_FIRST_RETRY_DURATION

      protected static final Duration DEFAULT_FIRST_RETRY_DURATION
    • firstRetryDelay

      protected Duration firstRetryDelay
    • maxRetryTimes

      protected Integer maxRetryTimes
  • Constructor Details

    • StreamingBuilder

      public StreamingBuilder()
  • Method Details

    • firstRetryDelay

      public StreamingBuilder firstRetryDelay(Duration duration)
      Sets the initial reconnect delay for the streaming connection.

      The streaming service uses a backoff algorithm (with jitter) every time the connection needs to be reestablished. The delay for the first reconnection will start near this value, and then increase exponentially for any subsequent connection failures.

      Parameters:
      duration - the reconnecting time base value; null to use the default(1s)
      Returns:
      the builder
    • maxRetryTimes

      public StreamingBuilder maxRetryTimes(Integer maxRetryTimes)
      Sets the max retry times for the streaming failures.
      Parameters:
      maxRetryTimes - an int value if less than or equals to 0, use the default
      Returns:
      the builder