This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/mymetrics") | |
| public class MetricsResource { | |
| @GET | |
| @Path("counted") | |
| @Counted | |
| public String getCounted(){ | |
| return "Counted"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/trace") | |
| public class TraceResource { | |
| @GET | |
| @Traced | |
| public String getTrace(){ | |
| return "Trace"; | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Readiness | |
| public class ReadinessCheck implements HealthCheck { | |
| @Override | |
| public HealthCheckResponse call() { | |
| Client client = ClientBuilder.newClient(); | |
| Response response = client.target("https://eldermoraes.com").request().get(); | |
| if (response.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL)){ | |
| return HealthCheckResponse.up("I'm ready!"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Liveness | |
| public class LivenessCheck implements HealthCheck { | |
| @Override | |
| public HealthCheckResponse call() { | |
| return HealthCheckResponse.up("I'm alive!"); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/circuit") | |
| public class CircuitResource { | |
| @Timeout(unit = ChronoUnit.MILLIS, value = 500) | |
| @Fallback(fallbackMethod = "fallback") | |
| @CircuitBreaker(requestVolumeThreshold = 4, failureRatio = 0.5, delay = 2000, delayUnit = ChronoUnit.MILLIS, successThreshold = 2) | |
| @GET | |
| public String getCircuit() throws InterruptedException { | |
| Thread.sleep(600); | |
| return "Circuit \n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| config=Config |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @Path("/config") | |
| public class ConfigResource { | |
| @ConfigProperty(name = "config") | |
| private Optional<String> config; | |
| @GET | |
| @Produces(MediaType.APPLICATION_JSON) | |
| public Response getConfig(){ | |
| return Response.ok("Hello, " + config.orElse("Optional")).build() ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module coffee.shop { | |
| requires coffee.module; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package coffee.shop; | |
| import coffee.module.Coffee; | |
| public class CoffeeShop { | |
| public static void main(String[] args) { | |
| System.out.println("Enjoy your " + Coffee.name()); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module coffee.module { | |
| exports coffee.module; | |
| } |
NewerOlder