Class ConsulEndpointGroupBuilder
java.lang.Object
com.linecorp.armeria.client.endpoint.AbstractDynamicEndpointGroupBuilder
com.linecorp.armeria.client.consul.ConsulEndpointGroupBuilder
- All Implemented Interfaces:
DynamicEndpointGroupSetters
,ConsulConfigSetters
@UnstableApi
public final class ConsulEndpointGroupBuilder
extends AbstractDynamicEndpointGroupBuilder
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 TypeMethodDescriptionallowEmptyEndpoints
(boolean allowEmptyEndpoints) Sets whether to allow an emptyEndpoint
list.build()
Returns a newly-createdConsulEndpointGroup
.consulApiVersion
(String consulApiVersion) Sets the specified Consul's API version.consulToken
(String consulToken) Sets the specified token for Consul's API.datacenter
(String datacenter) Sets which datacenter to query.Filters the endpoints using the Consul filter.registryFetchInterval
(Duration registryFetchInterval) Sets the interval between fetching registry requests.registryFetchIntervalMillis
(long registryFetchIntervalMillis) Sets the interval between fetching registry requests in milliseconds.selectionStrategy
(EndpointSelectionStrategy selectionStrategy) Sets theEndpointSelectionStrategy
of theConsulEndpointGroup
.selectionTimeout
(Duration selectionTimeout) Sets the timeout to wait until a successfulEndpoint
selection.selectionTimeoutMillis
(long selectionTimeoutMillis) Sets the timeout to wait until a successfulEndpoint
selection.useHealthEndpoints
(boolean useHealthyEndpoints) Sets whether to use Health HTTP endpoint.Methods inherited from class com.linecorp.armeria.client.endpoint.AbstractDynamicEndpointGroupBuilder
selectionTimeoutMillis, shouldAllowEmptyEndpoints
-
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
. -
allowEmptyEndpoints
Description copied from interface:DynamicEndpointGroupSetters
- Specified by:
allowEmptyEndpoints
in interfaceDynamicEndpointGroupSetters
- Overrides:
allowEmptyEndpoints
in classAbstractDynamicEndpointGroupBuilder
-
selectionTimeout
Sets the timeout to wait until a successfulEndpoint
selection.Duration.ZERO
disables the timeout. If unspecified,Flags.defaultResponseTimeoutMillis()
is used by default.- Specified by:
selectionTimeout
in interfaceDynamicEndpointGroupSetters
- Overrides:
selectionTimeout
in classAbstractDynamicEndpointGroupBuilder
-
selectionTimeoutMillis
Sets the timeout to wait until a successfulEndpoint
selection.0
disables the timeout. If unspecified,Flags.defaultResponseTimeoutMillis()
is used by default.- Specified by:
selectionTimeoutMillis
in interfaceDynamicEndpointGroupSetters
- Overrides:
selectionTimeoutMillis
in classAbstractDynamicEndpointGroupBuilder
-