public abstract class StreamingDataSourceBuilder extends java.lang.Object implements UpdateProcessorFactory
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(UpdateProcessorFactory)
:
LDConfig config = new LDConfig.Builder()
.dataSource(Components.streamingDataSource().initialReconnectDelayMillis(500))
.build();
These properties will override any equivalent deprecated properties that were set with LDConfig.Builder
,
such as LDConfig.Builder.reconnectTimeMs(long)
.
Note that this class is abstract; the actual implementation is created by calling Components.streamingDataSource()
.
Modifier and Type | Field and Description |
---|---|
protected java.net.URI |
baseURI |
static long |
DEFAULT_INITIAL_RECONNECT_DELAY_MILLIS
The default value for
initialReconnectDelayMillis(long) . |
protected long |
initialReconnectDelayMillis |
protected java.net.URI |
pollingBaseURI |
Constructor and Description |
---|
StreamingDataSourceBuilder() |
Modifier and Type | Method and Description |
---|---|
StreamingDataSourceBuilder |
baseURI(java.net.URI baseURI)
Sets a custom base URI for the streaming service.
|
StreamingDataSourceBuilder |
initialReconnectDelayMillis(long initialReconnectDelayMillis)
Sets the initial reconnect delay for the streaming connection.
|
StreamingDataSourceBuilder |
pollingBaseURI(java.net.URI pollingBaseURI)
Sets a custom base URI for special polling requests.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createUpdateProcessor
public static final long DEFAULT_INITIAL_RECONNECT_DELAY_MILLIS
initialReconnectDelayMillis(long)
.protected java.net.URI baseURI
protected java.net.URI pollingBaseURI
protected long initialReconnectDelayMillis
public StreamingDataSourceBuilder baseURI(java.net.URI baseURI)
You will only need to change this value in the following cases:
baseUri
to the base URI of the Relay Proxy instance.
baseURI
- the base URI of the streaming service; null to use the defaultpublic StreamingDataSourceBuilder initialReconnectDelayMillis(long initialReconnectDelayMillis)
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
.
initialReconnectDelayMillis
- the reconnect time base value in millisecondspublic StreamingDataSourceBuilder pollingBaseURI(java.net.URI pollingBaseURI)
Even in streaming mode, the SDK sometimes temporarily must do a polling request. You do not need to
modify this property unless you are connecting to a test server or a nonstandard endpoint for the
LaunchDarkly service. If you are using the Relay Proxy,
you only need to set baseURI(URI)
.
pollingBaseURI
- the polling endpoint URI; null to use the default