Class HealthCheckedEndpointGroupBuilder
java.lang.Object
com.linecorp.armeria.client.endpoint.healthcheck.AbstractHealthCheckedEndpointGroupBuilder
com.linecorp.armeria.client.endpoint.healthcheck.HealthCheckedEndpointGroupBuilder
public final class HealthCheckedEndpointGroupBuilder
extends AbstractHealthCheckedEndpointGroupBuilder
A builder for creating a new
HealthCheckedEndpointGroup that sends HTTP health check requests.-
Method Summary
Modifier and TypeMethodDescriptionclientFactory(ClientFactory clientFactory)Sets theClientFactoryto use when making health check requests.clientOptions(ClientOptions options)Sets theClientOptionsof theClientthat sends health check requests.maxEndpointCount(int maxEndpointCount)Sets the maximum endpoint count of target selected candidates.maxEndpointRatio(double maxEndpointRatio)Sets the maximum endpoint ratio of target selected candidates.protected Function<? super HealthCheckerContext,? extends AsyncCloseable>Returns theFunctionthat starts to send health check requests to theEndpointspecified in a givenHealthCheckerContextwhen invoked.port(int port)Sets the port where a health check request will be sent instead of the original port number specified byEndpointGroup'sEndpoints.protocol(SessionProtocol protocol)Sets theSessionProtocolto be used when making health check requests.retryBackoff(Backoff retryBackoff)Sets the backoff between health check requests.retryInterval(Duration retryInterval)Sets the interval between health check requests.retryIntervalMillis(long retryIntervalMillis)Sets the interval between health check requests in milliseconds.useGet(boolean useGet)Sets whether to use HTTPGETmethod instead ofHEADwhen sending a health check request.withClientOptions(Function<? super ClientOptionsBuilder,ClientOptionsBuilder> configurator)Methods inherited from class com.linecorp.armeria.client.endpoint.healthcheck.AbstractHealthCheckedEndpointGroupBuilder
build
-
Method Details
-
useGet
Sets whether to use HTTPGETmethod instead ofHEADwhen sending a health check request. By default,HEADmethod is used. This can be useful when the health check requests are failing due to a bad request or an authorization failure and you want to learn why. -
clientFactory
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets theClientFactoryto use when making health check requests. This should generally be the same as theClientFactoryused when creating aClientstub using theEndpointGroup.- Overrides:
clientFactoryin classAbstractHealthCheckedEndpointGroupBuilder
-
protocol
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets theSessionProtocolto be used when making health check requests.- Overrides:
protocolin classAbstractHealthCheckedEndpointGroupBuilder
-
port
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets the port where a health check request will be sent instead of the original port number specified byEndpointGroup'sEndpoints. This property is useful when your server listens to health check requests on a different port.- Overrides:
portin classAbstractHealthCheckedEndpointGroupBuilder
-
retryInterval
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets the interval between health check requests. Must be positive.- Overrides:
retryIntervalin classAbstractHealthCheckedEndpointGroupBuilder
-
retryIntervalMillis
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets the interval between health check requests in milliseconds. Must be positive.- Overrides:
retryIntervalMillisin classAbstractHealthCheckedEndpointGroupBuilder
-
retryBackoff
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets the backoff between health check requests.- Overrides:
retryBackoffin classAbstractHealthCheckedEndpointGroupBuilder
-
clientOptions
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets theClientOptionsof theClientthat sends health check requests. This method can be useful if you already have an Armeria client and want to reuse its configuration, such as using the same decorators.WebClient myClient = ...; // Use the same settings and decorators with `myClient` when sending health check requests. builder.clientOptions(myClient.options());- Overrides:
clientOptionsin classAbstractHealthCheckedEndpointGroupBuilder
-
withClientOptions
public HealthCheckedEndpointGroupBuilder withClientOptions(Function<? super ClientOptionsBuilder,ClientOptionsBuilder> configurator)Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets theFunctionthat customizes aClientthat sends health check requests.builder.withClientOptions(b -> { return b.setHeader(HttpHeaders.AUTHORIZATION, "bearer my-access-token") .responseTimeout(Duration.ofSeconds(3)); });- Overrides:
withClientOptionsin classAbstractHealthCheckedEndpointGroupBuilder
-
newCheckerFactory
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderReturns theFunctionthat starts to send health check requests to theEndpointspecified in a givenHealthCheckerContextwhen invoked. TheFunctionmust update the health of theEndpointwith a value between [0, 1] viaHealthCheckerContext.updateHealth(double).HealthCheckedEndpointGroupwill callAsyncCloseable.closeAsync()on theAsyncCloseablereturned by theFunctionwhen it needs to stop sending health check requests.- Specified by:
newCheckerFactoryin classAbstractHealthCheckedEndpointGroupBuilder
-
maxEndpointRatio
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets the maximum endpoint ratio of target selected candidates.- Overrides:
maxEndpointRatioin classAbstractHealthCheckedEndpointGroupBuilder- See Also:
PartialHealthCheckStrategyBuilder.maxEndpointRatio(double)
-
maxEndpointCount
Description copied from class:AbstractHealthCheckedEndpointGroupBuilderSets the maximum endpoint count of target selected candidates.- Overrides:
maxEndpointCountin classAbstractHealthCheckedEndpointGroupBuilder- See Also:
PartialHealthCheckStrategyBuilder.maxEndpointCount(int)
-