Class ConsulEndpointGroupBuilder
java.lang.Object
com.linecorp.armeria.client.consul.ConsulEndpointGroupBuilder
- All Implemented Interfaces:
ConsulConfigSetters
@UnstableApi public final class ConsulEndpointGroupBuilder extends Object implements ConsulConfigSetters
A builder class for
ConsulEndpointGroup
.
Examples
ConsulEndpointGroup endpointGroup = ConsulEndpointGroup.builder(consulUri, "myService")
.build();
List<Endpoint> endpoints = endpointGroup.endpoints();
sb.serverListener(listener);
-
Method Summary
Modifier and Type Method Description ConsulEndpointGroup
build()
Returns a newly-createdConsulEndpointGroup
.ConsulEndpointGroupBuilder
consulApiVersion(String consulApiVersion)
Sets the specified Consul's API version.ConsulEndpointGroupBuilder
consulToken(String consulToken)
Sets the specified token for Consul's API.ConsulEndpointGroupBuilder
datacenter(String datacenter)
Sets which datacenter to query.ConsulEndpointGroupBuilder
filter(String filter)
Filters the endpoints using the Consul filter.ConsulEndpointGroupBuilder
registryFetchInterval(Duration registryFetchInterval)
Sets the interval between fetching registry requests.ConsulEndpointGroupBuilder
registryFetchIntervalMillis(long registryFetchIntervalMillis)
Sets the interval between fetching registry requests in milliseconds.ConsulEndpointGroupBuilder
selectionStrategy(EndpointSelectionStrategy selectionStrategy)
Sets theEndpointSelectionStrategy
of theConsulEndpointGroup
.ConsulEndpointGroupBuilder
useHealthEndpoints(boolean useHealthyEndpoints)
Sets whether to use Health HTTP endpoint.
-
Method Details
-
selectionStrategy
Sets theEndpointSelectionStrategy
of theConsulEndpointGroup
. -
registryFetchInterval
Sets the interval between fetching registry requests. If not set, 10000L milliseconds is used by default. -
registryFetchIntervalMillis
Sets the interval between fetching registry requests in milliseconds. If not set, 10000L is used by default. -
useHealthEndpoints
Sets whether to use Health HTTP endpoint. Make sure that your target endpoints are health-checked by Consul before enabling this feature. -
datacenter
Sets which datacenter to query. If not set, the datacenter of the local agent is used by default. -
filter
Filters the endpoints using the Consul filter. If not set, all endpoints are returned. -
consulApiVersion
Description copied from interface:ConsulConfigSetters
Sets the specified Consul's API version.- Specified by:
consulApiVersion
in interfaceConsulConfigSetters
- Parameters:
consulApiVersion
- the version of Consul API service, default: "v1"
-
consulToken
Description copied from interface:ConsulConfigSetters
Sets the specified token for Consul's API.- Specified by:
consulToken
in interfaceConsulConfigSetters
- Parameters:
consulToken
- the token for accessing Consul API, default:null
-
build
Returns a newly-createdConsulEndpointGroup
.
-