public abstract class ServiceEndpointsBuilder
extends java.lang.Object
If you want to set non-default values for any of these properties, create a builder with Components.serviceEndpoints()
,
change its properties with the methods of this class, and pass it to LDConfig.Builder#serviceEndpoints(ServiceEndpointsBuilder)
.
The default behavior, if you do not change any of these properties, is that the SDK will connect to the standard endpoints in the LaunchDarkly production service. There are several use cases for changing these properties:
relayProxy(URI)
.
streaming(URI)
,
polling(URI)
, and events(URI)
.
Each of the setter methods can be called with either a URI
or an equivalent string.
Passing a string that is not a valid URI will cause an immediate IllegalArgumentException
.
If you are using a private instance and you set some of the base URIs, but not all of them, the SDK
will log an error and may not work properly. The only exception is if you have explicitly disabled
the SDK's use of one of the services: for instance, if you have disabled analytics events with
Components.noEvents()
, you do not have to set events(URI)
.
// Example of specifying a Relay Proxy instance
LDConfig config = new LDConfig.Builder()
.serviceEndpoints(
Components.serviceEndpoints()
.relayProxy("http://my-relay-hostname:80")
)
.build();
// Example of specifying a private LaunchDarkly instance
LDConfig config = new LDConfig.Builder()
.serviceEndpoints(
Components.serviceEndpoints()
.streaming("https://stream.mycompany.launchdarkly.com")
.polling("https://app.mycompany.launchdarkly.com")
.events("https://events.mycompany.launchdarkly.com"))
)
.build();
Modifier and Type | Field and Description |
---|---|
protected java.net.URI |
eventsBaseUri |
protected java.net.URI |
pollingBaseUri |
protected java.net.URI |
streamingBaseUri |
Constructor and Description |
---|
ServiceEndpointsBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract ServiceEndpoints |
createServiceEndpoints()
Called internally by the SDK to create a configuration instance.
|
ServiceEndpointsBuilder |
events(java.lang.String eventsBaseUri)
Equivalent to
events(URI) , specifying the URI as a string. |
ServiceEndpointsBuilder |
events(java.net.URI eventsBaseUri)
Sets a custom base URI for the events service.
|
ServiceEndpointsBuilder |
polling(java.lang.String pollingBaseUri)
Equivalent to
polling(URI) , specifying the URI as a string. |
ServiceEndpointsBuilder |
polling(java.net.URI pollingBaseUri)
Sets a custom base URI for the polling service.
|
ServiceEndpointsBuilder |
relayProxy(java.lang.String relayProxyBaseUri)
Equivalent to
relayProxy(URI) , specifying the URI as a string. |
ServiceEndpointsBuilder |
relayProxy(java.net.URI relayProxyBaseUri)
Specifies a single base URI for a Relay Proxy instance.
|
ServiceEndpointsBuilder |
streaming(java.lang.String streamingBaseUri)
Equivalent to
streaming(URI) , specifying the URI as a string. |
ServiceEndpointsBuilder |
streaming(java.net.URI streamingBaseUri)
Sets a custom base URI for the streaming service.
|
protected java.net.URI streamingBaseUri
protected java.net.URI pollingBaseUri
protected java.net.URI eventsBaseUri
public ServiceEndpointsBuilder events(java.net.URI eventsBaseUri)
You should only call this method if you are using a private instance or test fixture
(see ServiceEndpointsBuilder
). If you are using the LaunchDarkly Relay Proxy,
call relayProxy(URI)
instead.
LDConfig config = new LDConfig.Builder()
.serviceEndpoints(
Components.serviceEndpoints()
.streaming("https://stream.mycompany.launchdarkly.com")
.polling("https://app.mycompany.launchdarkly.com")
.events("https://events.mycompany.launchdarkly.com")
)
.build();
eventsBaseUri
- the base URI of the events service; null to use the defaultpublic ServiceEndpointsBuilder events(java.lang.String eventsBaseUri)
events(URI)
, specifying the URI as a string.eventsBaseUri
- the base URI of the events service; null to use the defaultpublic ServiceEndpointsBuilder polling(java.net.URI pollingBaseUri)
You should only call this method if you are using a private instance or test fixture
(see ServiceEndpointsBuilder
). If you are using the LaunchDarkly Relay Proxy,
call relayProxy(URI)
instead.
LDConfig config = new LDConfig.Builder()
.serviceEndpoints(
Components.serviceEndpoints()
.streaming("https://stream.mycompany.launchdarkly.com")
.polling("https://app.mycompany.launchdarkly.com")
.events("https://events.mycompany.launchdarkly.com")
)
.build();
pollingBaseUri
- the base URI of the polling service; null to use the defaultpublic ServiceEndpointsBuilder polling(java.lang.String pollingBaseUri)
polling(URI)
, specifying the URI as a string.pollingBaseUri
- the base URI of the events service; null to use the defaultpublic ServiceEndpointsBuilder relayProxy(java.net.URI relayProxyBaseUri)
When using the LaunchDarkly Relay Proxy, the SDK only needs to know the single base URI of the Relay Proxy, which will provide all the proxied service endpoints.
LDConfig config = new LDConfig.Builder()
.serviceEndpoints(
Components.serviceEndpoints()
.relayProxy("http://my-relay-hostname:8080")
)
.build();
relayProxyBaseUri
- the Relay Proxy base URI, or null to reset to default endpointspublic ServiceEndpointsBuilder relayProxy(java.lang.String relayProxyBaseUri)
relayProxy(URI)
, specifying the URI as a string.relayProxyBaseUri
- the Relay Proxy base URI, or null to reset to default endpointspublic ServiceEndpointsBuilder streaming(java.net.URI streamingBaseUri)
You should only call this method if you are using a private instance or test fixture
(see ServiceEndpointsBuilder
). If you are using the LaunchDarkly Relay Proxy,
call relayProxy(URI)
instead.
LDConfig config = new LDConfig.Builder()
.serviceEndpoints(
Components.serviceEndpoints()
.streaming("https://stream.mycompany.launchdarkly.com")
.polling("https://app.mycompany.launchdarkly.com")
.events("https://events.mycompany.launchdarkly.com")
)
.build();
streamingBaseUri
- the base URI of the streaming service; null to use the defaultpublic ServiceEndpointsBuilder streaming(java.lang.String streamingBaseUri)
streaming(URI)
, specifying the URI as a string.streamingBaseUri
- the base URI of the events service; null to use the defaultpublic abstract ServiceEndpoints createServiceEndpoints()