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 theClientFactory
to use when making health check requests.clientOptions(ClientOptions options)
Sets theClientOptions
of theClient
that 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 theFunction
that starts to send health check requests to theEndpoint
specified in a givenHealthCheckerContext
when invoked.port(int port)
Sets the port where a health check request will be sent instead of the original port number specified byEndpointGroup
'sEndpoint
s.protocol(SessionProtocol protocol)
Sets theSessionProtocol
to 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 HTTPGET
method instead ofHEAD
when 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 HTTPGET
method instead ofHEAD
when sending a health check request. By default,HEAD
method 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:AbstractHealthCheckedEndpointGroupBuilder
Sets theClientFactory
to use when making health check requests. This should generally be the same as theClientFactory
used when creating aClient
stub using theEndpointGroup
.- Overrides:
clientFactory
in classAbstractHealthCheckedEndpointGroupBuilder
-
protocol
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets theSessionProtocol
to be used when making health check requests.- Overrides:
protocol
in classAbstractHealthCheckedEndpointGroupBuilder
-
port
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets the port where a health check request will be sent instead of the original port number specified byEndpointGroup
'sEndpoint
s. This property is useful when your server listens to health check requests on a different port.- Overrides:
port
in classAbstractHealthCheckedEndpointGroupBuilder
-
retryInterval
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets the interval between health check requests. Must be positive.- Overrides:
retryInterval
in classAbstractHealthCheckedEndpointGroupBuilder
-
retryIntervalMillis
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets the interval between health check requests in milliseconds. Must be positive.- Overrides:
retryIntervalMillis
in classAbstractHealthCheckedEndpointGroupBuilder
-
retryBackoff
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets the backoff between health check requests.- Overrides:
retryBackoff
in classAbstractHealthCheckedEndpointGroupBuilder
-
clientOptions
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets theClientOptions
of theClient
that 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:
clientOptions
in classAbstractHealthCheckedEndpointGroupBuilder
-
withClientOptions
public HealthCheckedEndpointGroupBuilder withClientOptions(Function<? super ClientOptionsBuilder,ClientOptionsBuilder> configurator)Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets theFunction
that customizes aClient
that sends health check requests.builder.withClientOptions(b -> { return b.setHeader(HttpHeaders.AUTHORIZATION, "bearer my-access-token") .responseTimeout(Duration.ofSeconds(3)); });
- Overrides:
withClientOptions
in classAbstractHealthCheckedEndpointGroupBuilder
-
newCheckerFactory
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Returns theFunction
that starts to send health check requests to theEndpoint
specified in a givenHealthCheckerContext
when invoked. TheFunction
must update the health of theEndpoint
with a value between [0, 1] viaHealthCheckerContext.updateHealth(double)
.HealthCheckedEndpointGroup
will callAsyncCloseable.closeAsync()
on theAsyncCloseable
returned by theFunction
when it needs to stop sending health check requests.- Specified by:
newCheckerFactory
in classAbstractHealthCheckedEndpointGroupBuilder
-
maxEndpointRatio
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets the maximum endpoint ratio of target selected candidates.- Overrides:
maxEndpointRatio
in classAbstractHealthCheckedEndpointGroupBuilder
- See Also:
PartialHealthCheckStrategyBuilder.maxEndpointRatio(double)
-
maxEndpointCount
Description copied from class:AbstractHealthCheckedEndpointGroupBuilder
Sets the maximum endpoint count of target selected candidates.- Overrides:
maxEndpointCount
in classAbstractHealthCheckedEndpointGroupBuilder
- See Also:
PartialHealthCheckStrategyBuilder.maxEndpointCount(int)
-