Package co.featbit.server
Class StreamingBuilder
java.lang.Object
co.featbit.server.StreamingBuilder
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfirstRetryDelay(Duration duration) Sets the initial reconnect delay for the streaming connection.maxRetryTimes(Integer maxRetryTimes) Sets the max retry times for the streaming failures.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface co.featbit.server.exterior.DataSynchronizerFactory
createDataSynchronizer
-
Field Details
-
DEFAULT_FIRST_RETRY_DURATION
-
firstRetryDelay
-
maxRetryTimes
-
-
Constructor Details
-
StreamingBuilder
public StreamingBuilder()
-
-
Method Details
-
firstRetryDelay
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
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
-