Class StreamingDataSourceBuilder
- java.lang.Object
-
- com.launchdarkly.sdk.android.integrations.StreamingDataSourceBuilder
-
- All Implemented Interfaces:
ComponentConfigurer<DataSource>
public abstract class StreamingDataSourceBuilder extends java.lang.Object implements ComponentConfigurer<DataSource>
Contains methods for configuring the streaming data source.By default, the SDK uses a streaming connection to receive feature flag data from LaunchDarkly. If you want to customize the behavior of the connection, create a builder with
Components.streamingDataSource()
, change its properties with the methods of this class, and pass it toLDConfig.Builder.dataSource(ComponentConfigurer)
:LDConfig config = new LDConfig.Builder() .dataSource(Components.streamingDataSource().initialReconnectDelayMillis(500)) .build();
Note that this class is abstract; the actual implementation is created by calling
Components.streamingDataSource()
.- Since:
- 3.3.0
-
-
Field Summary
Fields Modifier and Type Field Description protected int
backgroundPollIntervalMillis
static int
DEFAULT_INITIAL_RECONNECT_DELAY_MILLIS
The default value forinitialReconnectDelayMillis(int)
: 1000 milliseconds.protected int
initialReconnectDelayMillis
-
Constructor Summary
Constructors Constructor Description StreamingDataSourceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamingDataSourceBuilder
backgroundPollIntervalMillis(int backgroundPollIntervalMillis)
Sets the interval between feature flag updates when the application is running in the background.StreamingDataSourceBuilder
initialReconnectDelayMillis(int initialReconnectDelayMillis)
Sets the initial reconnect delay for the streaming connection.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.launchdarkly.sdk.android.subsystems.ComponentConfigurer
build
-
-
-
-
Field Detail
-
DEFAULT_INITIAL_RECONNECT_DELAY_MILLIS
public static final int DEFAULT_INITIAL_RECONNECT_DELAY_MILLIS
The default value forinitialReconnectDelayMillis(int)
: 1000 milliseconds.- See Also:
- Constant Field Values
-
backgroundPollIntervalMillis
protected int backgroundPollIntervalMillis
-
initialReconnectDelayMillis
protected int initialReconnectDelayMillis
-
-
Method Detail
-
backgroundPollIntervalMillis
public StreamingDataSourceBuilder backgroundPollIntervalMillis(int backgroundPollIntervalMillis)
Sets the interval between feature flag updates when the application is running in the background.Even when configured to use streaming, the SDK will switch to polling when in the background (unless
LDConfig.Builder.disableBackgroundUpdating(boolean)
is set). This property determines how often polling will happen.The default value is
LDConfig.DEFAULT_BACKGROUND_POLL_INTERVAL_MILLIS
; the minimum isLDConfig.MIN_BACKGROUND_POLL_INTERVAL_MILLIS
.- Parameters:
backgroundPollIntervalMillis
- the reconnect time base value in milliseconds- Returns:
- the builder
-
initialReconnectDelayMillis
public StreamingDataSourceBuilder initialReconnectDelayMillis(int initialReconnectDelayMillis)
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.
The default value is
DEFAULT_INITIAL_RECONNECT_DELAY_MILLIS
.- Parameters:
initialReconnectDelayMillis
- the reconnect time base value in milliseconds- Returns:
- the builder
-
-