Class StreamingDataSourceBuilder
- java.lang.Object
-
- com.launchdarkly.sdk.server.integrations.StreamingDataSourceBuilder
-
- All Implemented Interfaces:
DataSourceFactory
public abstract class StreamingDataSourceBuilder extends java.lang.Object implements DataSourceFactory
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(DataSourceFactory)
: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:
- 4.12.0
-
-
Field Summary
Fields Modifier and Type Field Description protected java.net.URI
baseURI
static java.time.Duration
DEFAULT_INITIAL_RECONNECT_DELAY
The default value forinitialReconnectDelay(Duration)
: 1000 milliseconds.protected java.time.Duration
initialReconnectDelay
-
Constructor Summary
Constructors Constructor Description StreamingDataSourceBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StreamingDataSourceBuilder
baseURI(java.net.URI baseURI)
Sets a custom base URI for the streaming service.StreamingDataSourceBuilder
initialReconnectDelay(java.time.Duration initialReconnectDelay)
Sets the initial reconnect delay for the streaming connection.StreamingDataSourceBuilder
pollingBaseURI(java.net.URI pollingBaseURI)
Obsolete method for setting a different custom base URI for special polling requests.-
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.server.interfaces.DataSourceFactory
createDataSource
-
-
-
-
Field Detail
-
DEFAULT_INITIAL_RECONNECT_DELAY
public static final java.time.Duration DEFAULT_INITIAL_RECONNECT_DELAY
The default value forinitialReconnectDelay(Duration)
: 1000 milliseconds.
-
baseURI
protected java.net.URI baseURI
-
initialReconnectDelay
protected java.time.Duration initialReconnectDelay
-
-
Method Detail
-
baseURI
public StreamingDataSourceBuilder baseURI(java.net.URI baseURI)
Sets a custom base URI for the streaming service.You will only need to change this value in the following cases:
- You are using the Relay Proxy. Set
baseUri
to the base URI of the Relay Proxy instance. - You are connecting to a test server or a nonstandard endpoint for the LaunchDarkly service.
- Parameters:
baseURI
- the base URI of the streaming service; null to use the default- Returns:
- the builder
- You are using the Relay Proxy. Set
-
initialReconnectDelay
public StreamingDataSourceBuilder initialReconnectDelay(java.time.Duration initialReconnectDelay)
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
.- Parameters:
initialReconnectDelay
- the reconnect time base value; null to use the default- Returns:
- the builder
-
pollingBaseURI
public StreamingDataSourceBuilder pollingBaseURI(java.net.URI pollingBaseURI)
Obsolete method for setting a different custom base URI for special polling requests.Previously, LaunchDarkly sometimes required the SDK to temporarily do a polling request even in streaming mode (based on the size of the updated data item); this property specified the base URI for such requests. However, the system no longer has this behavior so this property is ignored. It will be deprecated and then removed in a future release.
- Parameters:
pollingBaseURI
- the polling endpoint URI; null to use the default- Returns:
- the builder
-
-