Package com.helixframework.api.health
Class HttpHealthIndicator.Builder
java.lang.Object
com.helixframework.api.health.HttpHealthIndicator.Builder
- Enclosing class:
- HttpHealthIndicator
The Builder class is a utility class used to create instances of HttpHealthIndicator.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns a new instance of HttpHealthIndicator.client(okhttp3.OkHttpClient client) Optional.Optional.healthCheck(Function<okhttp3.Response, org.springframework.boot.actuate.health.Health> healthCheck) Optional.maxFailures(int maxFailures) Optional.Optional.request(okhttp3.Request request) Sets the request to be used for making the HTTP health check.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
client
Optional. Sets the OkHttpClient used for making HTTP requests in the HttpHealthIndicator.- Parameters:
client- the OkHttpClient to set- Returns:
- the Builder object
-
request
Sets the request to be used for making the HTTP health check.- Parameters:
request- the request to be used- Returns:
- the Builder object
- Throws:
IllegalArgumentException- if the request is null
-
healthCheck
public HttpHealthIndicator.Builder healthCheck(Function<okhttp3.Response, org.springframework.boot.actuate.health.Health> healthCheck) Optional. Set the health check function for the HttpHealthIndicator.- Parameters:
healthCheck- the health check function to set- Returns:
- the Builder object
-
maxFailures
Optional. Sets the maximum number of consecutive failures allowed in the HttpHealthIndicator.If the provided number of failures is negative, the default maximum number of failures will be used.
- Parameters:
maxFailures- the maximum number of consecutive failures allowed- Returns:
- the Builder object
-
delay
Optional. Sets the delay for performing periodic health checks in the HttpHealthIndicator.If the provided delay is null or negative, the default update delay will be used.
- Parameters:
delay- the delay for performing health checks- Returns:
- the Builder object
-
period
Optional. Sets the period for performing periodic health checks in the HttpHealthIndicator.If the provided period is null or negative, the default update period will be used.
- Parameters:
period- the period for performing health checks- Returns:
- the Builder object
-
build
Builds and returns a new instance of HttpHealthIndicator.- Returns:
- a new HttpHealthIndicator instance
-