v2
v2.0 29/06/2018 | v2.1 19/10/2018 | v2.2 10/02/2019 | |
---|---|---|---|
01 Spec aligned with | Java EE 8 | Java EE 8 | Java EE 8 |
02 Based on | Java SE 8 | Java SE 8 | Java SE 8 |
03 CDI | v2.0 | v2.0 | v2.0 |
04 JAX-RS | v2.1 | v2.1 | v2.1 |
05 JSON-B | v1.0 | v1.0 | v1.0 |
06 JSON-P | v1.1 | v1.1 | v1.1 |
07 Common Annotations for Java platform | v1.3 | v1.3 | v1.3 |
08 Eclipse MicroProfile Config | v1.3 | v1.3 | v1.3 |
09 Eclipse MicroProfile Fault Tolerance | v1.1 | v1.1 | v2.0 |
10 Eclipse MicroProfile Health | v1.0 | v1.0 | v1.0 |
11 Eclipse MicroProfile JWT Authentication | v1.1 | v1.1 | v1.1 |
12 Eclipse MicroProfile Metrics | v1.1 | v1.1 | v1.1 |
13 Eclipse MicroProfile Open API | v1.0 | v1.0 | v1.1 |
14 Eclipse MicroProfile Open tracing | v1.1 | v1.2 | v1.3 |
15 Eclipse MicroProfile Rest Client | v1.1 | v1.1 | v1.2.0 |
Eclipse MicroProfile Config
GitHub repository
Configuration de l'app en dehors de l'app.
Rationale
The majority of applications need to be configured based on a running environment. It must be possible to modify configuration data from outside an application so that the application itself does not need to be repackaged.
The configuration data can come from different locations and in different formats (e.g. system properties, system environment variables, .properties, .xml, datasource). We call these config locations ConfigSources. If the same property is defined in multiple ConfigSources, we apply a policy to specify which one of the values will effectively be used.
Under some circumstances, some data sources may change dynamically. The changed values should be fed into the client without the need for restarting the application. This requirement is particularly important for microservices running in a cloud environment. The MicroProfile Config approach allows to pick up configured values immediately after they got changed.
Releases
- MP v2.0 : Config v1.3 - article
- MP v2.1 : Config v1.3 - article
- MP v2.2 : Config v1.3 - article
Key points
- values are read only by design
- several sources, orderd by priority
- Set of converters
@Inject @ConfigProperty(name = "foo.bar.url") private String url;
Eclipse MicroProfile Fault Tolerance
Rationale
Currently there are at least two libraries to provide fault tolerance. It is best to uniform the technologies and define a standard so that micro service applications can adopt and the implementation of fault tolerance can be provided by the containers if possible.
Releases
- MP v2.0 : Fault Tolerance v1.1
- MP v2.1 : Fault Tolerance v1.1
- MP v2.2 : Fault Tolerance v2.0 - article
With Istio - https://istio.io
Attention aux interactions entre annotations ! Certanines modifient le comportement d'autres !!!
- @Asynchronous → MUST return a Future
- @retry(retryOn=IOException.class, delay=500, maxRetries=5)
- @fallback(fallbackMethod="myFallback")
- @circuitBreaker(failOn=IOException.class, delay=500)
- @bulkhead → éviter de flooder un service avec plein de requetes
- @timeout(2000) // can trigger @Fallback, @Retry
→ https://github.com/NottyCode/fault-tolerence-examples
Eclipse MicroProfile Health
Rationale
Health checks are used to probe the state of a computing node from another machine (i.e. kubernetes service controller) with the primary target being cloud infrastructure environments where automated processes maintain the state of computing nodes.
In this scenario, health checks are used to determine if a computing node needs to be discarded (terminated, shutdown) and eventually replaced by another (healthy) instance.
It’s not intended (although could be used) as a monitoring solution for human operators.
Releases
- MP v2.0 : Health Check v1.0
- MP v2.1 : Health Check v1.0
- MP v2.2 : Health Check v1.0
Key point
- UP or DOWN
- extra data can be optionally specified (are you close to die?)
- check via HTTP
@Health public class FooBar implements HealthCheck {}
Eclipse MicroProfile JWT Authentication
Rationale
Eclipse MicroProfile JWT Authentication provides role based access control (RBAC) microservice endpoints using OpenID Connect (OIDC) and JSON Web Tokens (JWT).
Releases
- MP v2.0 : JWT Authentication v1.1 - article
- MP v2.1 : JWT Authentication v1.1 - article
- MP v2.2 : JWT Authentication v1.1 - article
@Claim
Eclipse MicroProfile Metrics
Inspired by Prometheus (and Dropwizard metrics)
(Reply with Prometheus format by default, and JSON (with application/json))
Rationale
This specification aims at providing a unified way for Microprofile servers to export Monitoring data ("Telemetry") to management agents and also a unified Java API, that all (application) programmers can use to expose their telemetry data.
Releases
- MP v2.0 : Metrics v1.1
- MP v2.1 : Metrics v1.1
- MP v2.2 : Metrics v1.1
@Counted
- monotonic=false : nb ACTUEL d'executions concurrentes de la méthode
- monotonic=false : nb TOTAL d'executions de la méthode
@Gauge(unit = MetricUnits.MEGABYTES) : sampled value
@Metered: durée moyenne
@Timed: duration statistics
@Metric:
3 scopes (registres)
- Base scope : standard, required CPU, threads, garbadge collector,…
- application scope : number of billings,…
- vendor specific : osgi,…
Eclipse MicroProfile Open API
Rationale
This MicroProfile specification aims at providing a unified Java API for the OpenAPI v3 specification, that all application developers can use to expose their API documentation.
→ OpenAPI Specification de l'OpenAPI Initiative (OAI) ≈ dérivé de Swagger
Releases
- MP v2.0 : Open API v1.0
- MP v2.1 : Open API v1.0
- MP v2.2 : Open API v1.1 - article
Eclipse MicroProfile OpenTracing (distributed tracing)
Rationale
The MicroProfile OpenTracing specification defines behaviors and an API for accessing an OpenTracing compliant Tracer object within your JAX-RS application. The behaviors specify how incoming and outgoing requests will have OpenTracing Spans automatically created. The API defines how to explicitly disable or enable tracing for given endpoints.
Releases
- MP v2.0 : OpenTracing v1.1
- MP v2.1 : OpenTracing v1.2
- MP v2.2 : OpenTracing v1.3 - article
- Suivre les appels à travers les différents microservices.
→ Zipkin implementation.
Eclipse MicroProfile Rest Client
GitHub repository
How to deal with 4xx responses in MicroProfile Rest-Client
Rationale
The MicroProfile Rest Client provides a type-safe approach to invoke RESTful services over HTTP. As much as possible the MP Rest Client attempts to use JAX-RS 2.0 APIs for consistency and easier re-use.
Releases
- MP v2.0 : Rest Client v1.1
- MP v2.1 : Rest Client v1.1
- MP v2.2 : Rest Client v1.2.0