Konzepte, Reviews GEDOPLAN IT Training Java, JEE, Tools u.v.a.m. in Berlin, Bielefeld, on-site JEE seit 1998 Speaker und Autor 2 gedoplan.de Mit MicroProfile und Quarkus in die Wolken
for Java) Produktname Jakarta EE Oracle behält Namens- und Urheberrechte Java EE Paketnamen javax.* Jakarta EE 8 codegleich zu Java EE 8 Release 10.09.2019 3 JEE gedoplan.de Mit MicroProfile und Quarkus in die Wolken
evolution“ „… optimize Enterprise Java for a microservices architecture …“ 4 Config Fault Tolerance Health JWT Authentication Metrics OpenAPI OpenTracing Rest Client CDI JAX-RS JSON-B JSON-P gedoplan.de Mit MicroProfile und Quarkus in die Wolken
Properties, …) JEE Server CDI Runtime JPA Runtime REST Runtime Technische Konfiguration * JRE build deploy run * DB-Verbindungen, Messaging Security … Thin WAR klein groß gedoplan.de Mit MicroProfile und Quarkus in die Wolken
JPA Runtime REST Runtime JRE build run * Anwendungsparameter, DB-Verbindungen, Messaging Security … Fat JAR JAR + Dependencies groß gedoplan.de Mit MicroProfile und Quarkus in die Wolken
Thorntail (aka WildFly Swarm) Optimiert für kurze Startzeiten Hotspot und GraalVM https://quarkus.io/ 7 gedoplan.de Mit MicroProfile und Quarkus in die Wolken
$ mvn quarkus:dev Listening for transport dt_socket at address: 5005 17:54:50,319 INFO [io.qua.dep.QuarkusAugmentor] (main) Beginning quarkus au 17:54:50,949 INFO [io.qua.resteasy] (build-1) Resteasy running without serv 17:54:50,949 INFO [io.qua.resteasy] (build-1) - Add quarkus-undertow to run 17:54:50,980 INFO [io.qua.dep.QuarkusAugmentor] (main) Quarkus augmentation 17:54:52,452 INFO [io.quarkus] (main) Quarkus started in 2.320s. Listening 17:54:52,452 INFO [io.quarkus] (main) Profile dev activated. Live Coding ac 17:54:52,454 INFO [io.quarkus] (main) Installed features: [cdi, resteasy] Demo quarkus-getting-started gedoplan.de Mit MicroProfile und Quarkus in die Wolken
test erweiterbar (z. B. System Property quarkus.profile) Seit 1.1.x auch application.yaml 12 greeting.message = Hello greeting.name = world %dev.greeting.name = developer %test.greeting.name = tester application.properties Demo quarkus-config gedoplan.de Mit MicroProfile und Quarkus in die Wolken
generiert konfigurierbare URL 15 @Path("v2") @RegisterRestClient public interface CountryApi { @GET @Path("all") @Produces("application/json") Collection<Country> getAll(); de.gedoplan.showcase.….CountryApi/mp-rest/url=http://restcountries.eu/rest META-INF/microprofile-config.properties @Path("country") @ApplicationScoped public class CountryResource { @Inject @RestClient CountryApi countryClient; @GET @Path("count") @Produces(MediaType.APPLICATION_JSON) public int getCount() { return countryClient.getAll().size(); gedoplan.de Mit MicroProfile und Quarkus in die Wolken
Fehler (=Exception) @Timeout bricht langsame Aufrufe ab @Fallback liefert Ersatzwert 16 @Retry(maxRetries = 4) public int doSomethingWithRetry() { @Timeout(1000) public int doSomethingWithTimeout() { private int return42() { return 42; } @Fallback(fallbackMethod = "return42") public int doSomethingWithFallback() { gedoplan.de Mit MicroProfile und Quarkus in die Wolken
hoher Fehlerrate 17 @CircuitBreaker(failureRatio = 0.25, requestVolumeThreshold = 10) public int doSomethingWithCircuitBreaker() { closed open half-open zu viele Fehler ok Delay Fehler gedoplan.de Mit MicroProfile und Quarkus in die Wolken
no decorators, portable extensions, specialization, passivation ignore beans.xml contents Build time DI JPA-Implementierung Hibernate Datasource-Konfiguration in application.properties DB-Extensions für PostgreSQL, H2, MariaDB, MS SQL, Derby 18 Demo quarkus-rest-cdi-jpa gedoplan.de Mit MicroProfile und Quarkus in die Wolken
Test Runner Test Profile u. a. anderer HTTP-Port 19 Demo quarkus-config @QuarkusTest public class GreetingResourceTest { @Test public void testHelloEndpoint() { given() .when().get("/hello") .then() .statusCode(200) .body(is("Hello tester!!!")); } gedoplan.de Mit MicroProfile und Quarkus in die Wolken
Code Build auf Non- Linux im Docker Container Startzeit im ms-Bereich, Memory consumption im (kleinen) MB-Bereich 20 gedoplan.de quarkus-getting-started $ mvn -Pnative,docker … [INFO] docker run -v //c/GEDOPLAN/projects/gedoplan/showcase/quar [quarkus-getting-started-runner:22] classlist: 4,939.89 ms … [quarkus-getting-started-runner:22] write: 576.45 ms [quarkus-getting-started-runner:22] [total]: 121,756.96 ms [INFO] Quarkus augmentation completed in 126125ms … [INFO] DOCKER> Built image sha256:0eb9a Mit MicroProfile und Quarkus in die Wolken
imperative) mit AMQP, Kafka, JMS NoSQL Flyway Security mit OpenID, Keycloak, JWT RBAC Spring DI, Web, Data JPA, Security Scheduling Mail JSF … 21 gedoplan.de Mit MicroProfile und Quarkus in die Wolken
Spring Boot für JEE kaum Umdenken notwendig für JEE-Entwickler macht Spaß native Ausführung möglich Richtung: Cloud, serverless (?) 22 gedoplan.de Mit MicroProfile und Quarkus in die Wolken
(2020): Microservices mit Quarkus – Grundlagen/Aufbau/kompakt neu (2019): Java DevOps: Development und Delivery mit Docker, Kubernetes und Jenkins www.gedoplan-it-consulting.de Reviews, Coaching, … Blog [email protected] @dirkweil 23 gedoplan.de Mit MicroProfile und Quarkus in die Wolken