public abstract class StreamingDataSourceBuilder extends java.lang.Object implements ComponentConfigurer<DataSource>
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 to LDConfig.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()
.
Modifier and Type | Field and Description |
---|---|
static java.time.Duration |
DEFAULT_INITIAL_RECONNECT_DELAY
The default value for
initialReconnectDelay(Duration) : 1000 milliseconds. |
protected java.time.Duration |
initialReconnectDelay |
protected java.lang.String |
payloadFilter |
Constructor and Description |
---|
StreamingDataSourceBuilder() |
Modifier and Type | Method and Description |
---|---|
StreamingDataSourceBuilder |
initialReconnectDelay(java.time.Duration initialReconnectDelay)
Sets the initial reconnect delay for the streaming connection.
|
StreamingDataSourceBuilder |
payloadFilter(java.lang.String payloadFilter)
Sets the Payload Filter that will be used to filter the objects (flags, segments, etc.)
from this data source.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
build
public static final java.time.Duration DEFAULT_INITIAL_RECONNECT_DELAY
initialReconnectDelay(Duration)
: 1000 milliseconds.protected java.time.Duration initialReconnectDelay
protected java.lang.String payloadFilter
public StreamingDataSourceBuilder initialReconnectDelay(java.time.Duration initialReconnectDelay)
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
.
initialReconnectDelay
- the reconnect time base value; null to use the defaultpublic StreamingDataSourceBuilder payloadFilter(java.lang.String payloadFilter)
payloadFilter
- the filter to be used