public static class LDConfig.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder()
Creates a builder with all configuration parameters set to the default
|
Modifier and Type | Method and Description |
---|---|
LDConfig.Builder |
allAttributesPrivate(boolean allPrivate)
Set whether or not user attributes (other than the key) should be hidden from LaunchDarkly.
|
LDConfig.Builder |
baseURI(java.net.URI baseURI)
Set the base URL of the LaunchDarkly server for this configuration.
|
LDConfig |
build()
Builds the configured
LDConfig object. |
LDConfig.Builder |
capacity(int capacity)
Set the capacity of the events buffer.
|
LDConfig.Builder |
connectTimeout(int connectTimeout)
Set the connection timeout in seconds for the configuration.
|
LDConfig.Builder |
connectTimeoutMillis(int connectTimeoutMillis)
Set the connection timeout in milliseconds for the configuration.
|
LDConfig.Builder |
eventProcessorFactory(EventProcessorFactory factory)
Sets the implementation of
EventProcessor to be used for processing analytics events,
using a factory object. |
LDConfig.Builder |
eventsURI(java.net.URI eventsURI)
Set the base URL of the LaunchDarkly analytics event server for this configuration.
|
LDConfig.Builder |
featureStore(FeatureStore store)
Deprecated.
Please use
featureStoreFactory . |
LDConfig.Builder |
featureStoreFactory(FeatureStoreFactory factory)
Sets the implementation of
FeatureStore to be used for holding feature flags and
related data received from LaunchDarkly, using a factory object. |
LDConfig.Builder |
flushInterval(int flushInterval)
Set the number of seconds between flushes of the event buffer.
|
LDConfig.Builder |
inlineUsersInEvents(boolean inlineUsersInEvents)
Sets whether to include full user details in every analytics event.
|
LDConfig.Builder |
offline(boolean offline)
Set whether this client is offline.
|
LDConfig.Builder |
pollingIntervalMillis(long pollingIntervalMillis)
Set the polling interval (when streaming is disabled).
|
LDConfig.Builder |
privateAttributeNames(java.lang.String... names)
Marks a set of attribute names private.
|
LDConfig.Builder |
proxyHost(java.lang.String host)
Set the host to use as an HTTP proxy for making connections to LaunchDarkly.
|
LDConfig.Builder |
proxyPassword(java.lang.String password)
Sets the password for the optional HTTP proxy.
|
LDConfig.Builder |
proxyPort(int port)
Set the port to use for an HTTP proxy for making connections to LaunchDarkly.
|
LDConfig.Builder |
proxyUsername(java.lang.String username)
Sets the username for the optional HTTP proxy.
|
LDConfig.Builder |
reconnectTimeMs(long reconnectTimeMs)
The reconnect base time in milliseconds for the streaming connection.
|
LDConfig.Builder |
samplingInterval(int samplingInterval)
Enable event sampling.
|
LDConfig.Builder |
sendEvents(boolean sendEvents)
Set whether to send events back to LaunchDarkly.
|
LDConfig.Builder |
socketTimeout(int socketTimeout)
Set the socket timeout in seconds for the configuration.
|
LDConfig.Builder |
socketTimeoutMillis(int socketTimeoutMillis)
Set the socket timeout in milliseconds for the configuration.
|
LDConfig.Builder |
startWaitMillis(long startWaitMillis)
Set how long the constructor will block awaiting a successful connection to LaunchDarkly.
|
LDConfig.Builder |
stream(boolean stream)
Set whether streaming mode should be enabled.
|
LDConfig.Builder |
streamURI(java.net.URI streamURI)
Set the base URL of the LaunchDarkly streaming server for this configuration.
|
LDConfig.Builder |
updateProcessorFactory(UpdateProcessorFactory factory)
Sets the implementation of
UpdateProcessor to be used for receiving feature flag data,
using a factory object. |
LDConfig.Builder |
useLdd(boolean useLdd)
Set whether this client should use the LaunchDarkly
relay in daemon mode, versus subscribing to the streaming or polling API.
|
LDConfig.Builder |
userKeysCapacity(int capacity)
Sets the number of user keys that the event processor can remember at any one time, so that
duplicate user details will not be sent in analytics events.
|
LDConfig.Builder |
userKeysFlushInterval(int flushInterval)
Sets the interval in seconds at which the event processor will reset its set of known user keys.
|
public Builder()
public LDConfig.Builder baseURI(java.net.URI baseURI)
baseURI
- the base URL of the LaunchDarkly server for this configuration.public LDConfig.Builder eventsURI(java.net.URI eventsURI)
eventsURI
- the events URL of the LaunchDarkly server for this configurationpublic LDConfig.Builder streamURI(java.net.URI streamURI)
streamURI
- the base URL of the LaunchDarkly streaming serverpublic LDConfig.Builder featureStore(FeatureStore store)
featureStoreFactory
.FeatureStore
to be used for holding feature flags and
related data received from LaunchDarkly. The default is InMemoryFeatureStore
, but
you may use RedisFeatureStore
or a custom implementation.store
- the feature store implementationpublic LDConfig.Builder featureStoreFactory(FeatureStoreFactory factory)
FeatureStore
to be used for holding feature flags and
related data received from LaunchDarkly, using a factory object. The default is
Components.inMemoryFeatureStore()
, but you may use Components.redisFeatureStore()
or a custom implementation.factory
- the factory objectpublic LDConfig.Builder eventProcessorFactory(EventProcessorFactory factory)
EventProcessor
to be used for processing analytics events,
using a factory object. The default is Components.defaultEventProcessor()
, but
you may choose to use a custom implementation (for instance, a test fixture).factory
- the factory objectpublic LDConfig.Builder updateProcessorFactory(UpdateProcessorFactory factory)
UpdateProcessor
to be used for receiving feature flag data,
using a factory object. The default is Components.defaultUpdateProcessor()
, but
you may choose to use a custom implementation (for instance, a test fixture).factory
- the factory objectpublic LDConfig.Builder stream(boolean stream)
stream
- whether streaming mode should be enabledpublic LDConfig.Builder connectTimeout(int connectTimeout)
Both this method and connectTimeoutMillis
affect the same property internally.
connectTimeout
- the connection timeout in secondspublic LDConfig.Builder socketTimeout(int socketTimeout)
Both this method and socketTimeoutMillis
affect the same property internally.
socketTimeout
- the socket timeout in secondspublic LDConfig.Builder connectTimeoutMillis(int connectTimeoutMillis)
Both this method and connectTimeoutMillis
affect the same property internally.
connectTimeoutMillis
- the connection timeout in millisecondspublic LDConfig.Builder socketTimeoutMillis(int socketTimeoutMillis)
Both this method and socketTimeoutMillis
affect the same property internally.
socketTimeoutMillis
- the socket timeout in millisecondspublic LDConfig.Builder flushInterval(int flushInterval)
flushInterval
- the flush interval in secondspublic LDConfig.Builder capacity(int capacity)
capacity
- the capacity of the event bufferpublic LDConfig.Builder proxyHost(java.lang.String host)
proxyPort(int)
is specified, this will default to localhost
.
If neither proxyHost(String)
nor proxyPort(int)
are specified,
a proxy will not be used, and LDClient
will connect to LaunchDarkly directly.
host
- the proxy hostnamepublic LDConfig.Builder proxyPort(int port)
port
- the proxy portpublic LDConfig.Builder proxyUsername(java.lang.String username)
proxyPassword(String)
is also called.username
- the proxy usernamepublic LDConfig.Builder proxyPassword(java.lang.String password)
proxyUsername(String)
is also called.password
- the proxy passwordpublic LDConfig.Builder useLdd(boolean useLdd)
useLdd
- true to use the relay in daemon mode; false to use streaming or pollingpublic LDConfig.Builder offline(boolean offline)
offline
- when set to true no calls to LaunchDarkly will be madepublic LDConfig.Builder allAttributesPrivate(boolean allPrivate)
privateAttributeNames(String...)
. By default,
this is false.allPrivate
- true if all user attributes should be privatepublic LDConfig.Builder sendEvents(boolean sendEvents)
offline
in that it only affects sending
analytics events, not streaming or polling for events from the server.sendEvents
- when set to false, no events will be sent to LaunchDarklypublic LDConfig.Builder pollingIntervalMillis(long pollingIntervalMillis)
pollingIntervalMillis
- rule update polling interval in millisecondspublic LDConfig.Builder startWaitMillis(long startWaitMillis)
startWaitMillis
- milliseconds to waitpublic LDConfig.Builder samplingInterval(int samplingInterval)
samplingInterval
chance events will be will be sent.
Example: if you want 5% sampling rate, set samplingInterval
to 20.
samplingInterval
- the sampling interval.public LDConfig.Builder reconnectTimeMs(long reconnectTimeMs)
reconnectTimeMs
- the reconnect time base value in millisecondspublic LDConfig.Builder privateAttributeNames(java.lang.String... names)
names
- a set of names that will be removed from user data set to LaunchDarklypublic LDConfig.Builder userKeysCapacity(int capacity)
capacity
- the maximum number of user keys to rememberpublic LDConfig.Builder userKeysFlushInterval(int flushInterval)
flushInterval
- the flush interval in secondspublic LDConfig.Builder inlineUsersInEvents(boolean inlineUsersInEvents)
inlineUsersInEvents
- true if you want full user details in each event