Package io.smallrye.health.checks
Class UrlHealthCheck
- java.lang.Object
-
- io.smallrye.health.checks.UrlHealthCheck
-
- All Implemented Interfaces:
org.eclipse.microprofile.health.HealthCheck
public class UrlHealthCheck extends Object implements org.eclipse.microprofile.health.HealthCheck
Health check implementation to check if host is reachable using a Http URL connection.@Produces @ApplicationScoped @Liveness HealthCheck check1() { return new UrlHealthCheck("www.google.com"); }- See Also:
Socket
-
-
Constructor Summary
Constructors Constructor Description UrlHealthCheck(String url)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.microprofile.health.HealthCheckResponsecall()UrlHealthCheckname(String name)Sets the name of the health check.UrlHealthCheckrequestMethod(String requestMethod)Sets the request method to be used (ie GET, POST, PUT, ...)UrlHealthCheckstatusCode(int statusCode)Sets the expected status code to be returned as valid.UrlHealthChecktimeout(int timeout)Sets timeout in millis.
-
-
-
Constructor Detail
-
UrlHealthCheck
public UrlHealthCheck(String url)
-
-
Method Detail
-
call
public org.eclipse.microprofile.health.HealthCheckResponse call()
- Specified by:
callin interfaceorg.eclipse.microprofile.health.HealthCheck
-
name
public UrlHealthCheck name(String name)
Sets the name of the health check.- Parameters:
name- of health check.- Returns:
- UrlHealthCheck instance.
-
timeout
public UrlHealthCheck timeout(int timeout)
Sets timeout in millis.- Parameters:
timeout- in millis.- Returns:
- UrlHealthCheck instance.
-
statusCode
public UrlHealthCheck statusCode(int statusCode)
Sets the expected status code to be returned as valid.- Parameters:
statusCode- expected.- Returns:
- UrlHealthCheck instance.
-
requestMethod
public UrlHealthCheck requestMethod(String requestMethod)
Sets the request method to be used (ie GET, POST, PUT, ...)- Parameters:
requestMethod- to use.- Returns:
- UrlHealthCheck instance.
-
-