O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

TechEvent Eclipse Microprofile

27 visualizações

Publicada em

Eclipse Microprofile - An Introduction

Publicada em: Tecnologia
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

TechEvent Eclipse Microprofile

  1. 1. BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH Eclipse Microprofile An Introduction Thomas Boshell
  2. 2. TechEvent September 20182 10/1/2018 https://microprofile.io
  3. 3. Microprofile TechEvent September 20183 10/1/2018 Started in 2016 by delegates from the leading EE servers The minimum number of APIs to build a microservice. Original baseline: JAX-RS + CDI + JSON-P. Version1. Restful webservices that work with JSON and have Container Dependency Injection PLUS: dedicated lightweight microprofile servers
  4. 4. TechEvent September 20184 10/1/2018 Version Spec Included Passed TCK In Progress 1.3 Open API 1.0, Open Tracing 1.0, Type Safe Rest Client 1.0, Config 1.2, Fault Tolerance 1.0, JWT Auth 1.0, Metrics 1.1, Health 1.0, CDI 1.2, JSON-P 1.0, JAX-RS 2.0 Open Liberty WebSphere Liberty, Payara Server, Payara Micro SmallRye 1.2 Config 1.1, Fault Tolerance 1.0, JWT Auth 1.0, Metrics 1.0, Health 1.0, CDI 1.2, JSON-P 1.0, JAX-RS 2.0 Open Liberty, WebSphere Liberty, WildFly Swarm, Payara Server, Payara Micro 1.1 Config 1.0, CDI 1.2, JSON-P 1.0, JAX-RS 2.0 Launcher, Hammock, Payara Server, Payara Micro TomEE 8 1.0 CDI 1.2, JSON-P 1.0, JAX-RS 2.0 WildFly Swarm, WebSphere Liberty, TomEE 7.0.x *Source: https://wiki.eclipse.org/MicroProfile/Implementation
  5. 5. Maven TechEvent September 20185 10/1/2018 <dependency> <groupId>org.eclipse.microprofile</groupId> <artifactId>microprofile</artifactId> <version>1.3</version> <type>pom</type> <scope>provided</scope> </dependency> One Maven statement enables it all!
  6. 6. The Projects TechEvent September 20186 10/1/2018 Standard Java Container Enabled  JAX-RS  CDI  JSON-P Eclipse Microprofile Sub-Projects  Open API  Open Tracing  Type Safe Rest Client  Config  Fault Tolerance  JWT Auth  Metrics  Health Common interface functionality for supporting microservices defined for all implementing servers.
  7. 7. JAX-RS, CDI, JSON-P TechEvent September 20187 10/1/2018 Java Enterprise Standards https://javaee.github.io/jsonp/ https://github.com/jax-rs http://cdi-spec.org/ @ApplicationPath(“/”) ….extends javax.ws.rs.core.Application @Path, @Produces, @Get, @Put, @PathParam (ect, like we know) javax.ws.rs-api-2.0.1 @Inject, @RequestScoped, @ApplicationScoped, and so on. CDI-api-1.2, java.inject-1
  8. 8. Config TechEvent September 20188 10/1/2018 https://microprofile.io/project/eclipse/microprofile-config Config Sources  System.getProperties() (ordinal=400)  System.getenv() (ordinal=300)  META-INF/microprofile-config.properties (ordinal=100) Microprofile Config is used across the other projects. Easy to Use Example: @Inject @ConfigProperty(name="someprop.key") String someProp; Use these and/or create a custom configuration
  9. 9. Health TechEvent September 20189 10/1/2018 https://microprofile.io/project/eclipse/microprofile-health “health checks are used to determine if a computing node needs to be discarded (terminated, shutdown) and eventually replaced by another (healthy) instance” 2 Parts: a wireframe protocol & a Java API (@Health, HealthCheck, HealthCheckResponse) 3 Goals: 1. Must be compatable with known cloud platforms ie http://kubernetes.io/docs/user-guide/liveness/ 2. Must be appropriate for machine to machine communication 3. Should give enough info for a human administrator /health GET 200, 500, 503
  10. 10. Metrics Microprofile, introduction10 10/1/2018 https://microprofile.io/project/eclipse/microprofile-metrics Tags: • @Counted • @Gauge • @Metered • @Metric • @Timed /metrics (accessed via https) @Timed(name = "serviceTimerOne", description = "A timer for myService", reusable = true) @Counted(name = "myServiceCntr", description = “cnt # myService is called", reusable = true) public WrappingObject myService(final String name, final String path) {...}
  11. 11. Fault Tolerance TechEvent September 201811 10/1/2018 https://microprofile.io/project/eclipse/microprofile-fault-tolerance Fault Tolerance through common strategies: TimeOut, Retry, Bulkhead, Circuitbreaker, Fallback Similar libraries: Hystrix & Failsafe CDI approach to make a loosely couple and configurable recovery mechanism. @Asynchronous (method should return a Future) @Timeout (miliseconds) @Retry (many options) @Fallback (performed once Retry or Circuitbreaker failed, define a Handler class or method) @CircuitBreaker (thresholds, failureratio) @Bulkhead (#concurrent requests, thread pools)
  12. 12. Open Tracing TechEvent September 201812 10/1/2018 https://microprofile.io/project/eclipse/microprofile-opentracing Distributed tracing enablement without explicit coding @Traced (class or method level) http://opentracing.io/ Tools like with elasticsearch, zipkin
  13. 13. Open API TechEvent September 201813 10/1/2018 https://microprofile.io/project/eclipse/microprofile-open-api Online, self-hosting interface documentation with Open API v.3 https://www.openapis.org/ https://swagger.io/specification/ Annotations: • @OpenAPIDefinition • @Info • @ApiResponses • @ApiResponse • @Content • @Schema /openapi  plain text (yaml) representation /openapi/ui  html format
  14. 14. JWT Auth TechEvent September 201814 14.09.2018 https://microprofile.io/project/eclipse/microprofile-jwt-auth Proposal using OpenID Connect based on JSON Web Token for role-based control of microservice endpoints. Injection annotations: @LoginConfig, @Claim Allowed through container and utilizes javax.annotation.security.* @RolesAllowed Authenticated JWT tokens requiring a server generated public key
  15. 15. Type Safe Rest Client TechEvent September 201815 10/1/2018 https://microprofile.io/project/eclipse/microprofile-rest-client Defines only the interface. Currently only 3 server implementations. The framework handles the rest. Build with DSL Style Example: URI apiUri = new URI("http://localhost:9080/movieReviewService"); MovieReviewService reviewSvc = RestClientBuilder.newBuilder() .baseUri(apiUri) .build(MovieReviewService.class); Review review = new Review(3 /* stars */, "This was a delightful comedy, but not terribly realistic."); reviewSvc.submitReview( movieId, review );
  16. 16. Latest Updates Bezeichnung Präsentation16 10/1/2018 Versions: 1.4 & 2.0: Java 7 & 8 Version: 1.4 updates: MicroProfile Config, MicroProfile Fault Tolerance, MicroProfile JWT Authentication, MicroProfile Open Tracing, and MicroProfile Rest Client. Version: 2.0 builds upon 1.4, JSON-P & JAX-RS up .1, and adds json-b and updated common annotations: JSR-250. (annotaitons like: Generated, Resource, Resources, PostConstruct, PreDestroy, RolesAllowed) Simplified Online MicroProfileStarter: http://mp-starter-jessie.1d35.starter-us-east-1.openshiftapps.com/mp-starter
  17. 17. 17 14.09.2018 Thanks for listening! TechEvent September 2018
  18. 18. Thomas Boshell Phone +4969264933039 Mobile +49 162-2916582 thomas.boshell@trivadis.com 10/1/2018 TechEvent September 201818
  19. 19. Session Feedback – now TechEvent September 201819 14.09.2018 Please use the Trivadis Events mobile app to give feedback on each session Use "My schedule" if you have registered for a session Otherwise use "Agenda" and the search function If the mobile app does not work (or if you have a Windows smartphone), use your smartphone browser – URL: http://trivadis.quickmobileplatform.eu/ – User name: <your_loginname> (such as "svv") – Password: sent by e-mail...

×