En esta sesión los asistentes presenciaron la base teórica y práctica para la creación de micro servicios con Java, JakartaEE, MicroProfile utilizando TomEE como servidor de aplicaciones.
5. @CesarHgt @tomitribe@jugnicaragua
A microservice architectural style is an approach to
developing a single application as a suite of small services,
each running in its own process and communicating with
lightweight mechanisms, often an HTTP resource API.
— Martin Fowler
11. @CesarHgt @tomitribe@jugnicaragua
● 46% of organizations are already building microservices
● 20% of organizations plan to build microservices in the next year
● 45% of developers are using Java to build microservices
● 21% of developers plan to use Java to build microservices in the next
year
● 15% of developers have already adopted MicroProfile
Microservices and Cloud-native
Source: Jakarta EE Developer Survey 2018 - The Eclipse Foundation’s global survey of 1,800 Java developers.
13. @CesarHgt @tomitribe@jugnicaragua
Eclipse MicroProfile
● An open-source community specification
● Focus on Enterprise Java microservices
● Generates: SPEC, API, and TCK.
● https://microprofile.io
● Implemented by different vendors.
29. @CesarHgt @tomitribe@jugnicaragua
● Where to store configurations?
○ The default config sources always available by default are:
■ System properties (ordinal=400)
■ Environment properties (ordinal=300)
■ /META-INF/microprofile-config.properties (ordinal=100)
○ The priority will be used to order the ConfigSource implementations to search for
the configuration key.
MicroProfile Configuration
34. @CesarHgt @tomitribe@jugnicaragua
Health Feature
● Probes state of services and resources.
● Infrastructure benefits
● It’s intended as a machine to machine (M2M) mechanism
● Examples: CloudFoundry Health Checks and Kubernetes Liveness and
Readiness Probes.
35. @CesarHgt @tomitribe@jugnicaragua
Familiarize yourself with the API
● Default endpoints:
○ http://host:port/health
○ http://host:port/<app-context>/health
● General output:
○ {"checks":[],"outcome":"UP","status":"UP"}
40. @CesarHgt @tomitribe@jugnicaragua
Difference to health checks
● Health checks
○ "Is my application still running ok?".
● Metrics:
○ Determine the overall the microservices health.
○ Provide long term trend data.
45. @CesarHgt @tomitribe@jugnicaragua
What is JWT?
● Stands for JSON Web Token.
● It’s a JSON-based text format for exchanging information between
parties.
● It’s an open standard specified under RFC 7519.
● Standards such as OpenID Connect and OAuth 2 use JWT to represent
their own tokens.
47. @CesarHgt @tomitribe@jugnicaragua
● Standard
● Interoperability across the enterprise and vendors that favors
microservices development.
● JWT can be both verified and propagated by each microservice.
Why do we need MicroProfile JWT?
53. @CesarHgt @tomitribe@jugnicaragua
The Rise of Resilience and Eventual Consistency
● Distributed systems
● All-or-nothing approach.
● Resilience
● Design patterns under the Fault Tolerance umbrella:
○ Bulkhead – isolate failures in part of the system.
○ Circuit breaker – offer a way to fail fast.
○ Retry – define criteria on when to retry.
○ Fallback – provide an alternative solution for a failed execution.
○ Timeout
54. @CesarHgt @tomitribe@jugnicaragua
@Timeout @Retry
import org.eclipse.microprofile.faulttolerance.Timeout;
@Timeout(500)
public String callSomeServiceLogic() {...}
@Retry(retryOn = IOException.class)
public String callSomeServiceLogic() {...}
@Timeout(500)
@Retry(maxRetries = 1)
public String callSomeService() {...}