SlideShare a Scribd company logo
1 of 63
Emily Jiang, Java Champion
IBM, STSM, Cloud Native Architect and Advocate
16th November 2023
Master a Cloud Native
Application Standard:
MicroProfile
Agenda
01
02
03
2
MicroProfile Background
MicroProfile Deep Dive
MicroProfile Future
Community
Driven
Lightweight,
Iterative Processes
Specs, APIs, TCKs
Implementations
WebSphere
Liberty
Working Group members
MicroProfile 1.0
(Fall 2016)
MicroProfile 1.1
(Aug. 2017)
MicroProfile 1.2
(Sept 2017)
2017
2018
MicroProfile 1.3
(Dec 2017)
MicroProfile 1.4
(June 2018)
2019
MicroProfile 2.0.1
(July 2018)
MicroProfile 2.1
(Oct 2018)
MicroProfile 2.2
(Feb 2019)
MicroProfile 3.0
(June 2019)
MicroProfile 3.2
(Nov 2019)
2020
MicroProfile 3.3
(Feb 2020)
MicroProfile 4.0
(Oct. 2020)
MicroProfile 4.1
(July. 2021)
MicroProfile 5.0
(Dec. 2021)
Config 3.0
Metrics 4.0
Fault Tolerance 4.0
Health 4.0
Rest Client 3.0
OpenAPI 3.0
OpenTracing 3.0
JWT Auth 2.0
Jakarta CDI 3.0 //Jakarta EE 9.1
Jakarta RESTful Web Services //Jakarta EE 9.1
Jakarta JSON-P //Jakarta EE 9.1
Jakarta JSON-B 2.0 //Jakarta EE 9.1
Jakarta Annotations 2.0 //Jakarta EE 9.1
2022
2021
MicroProfile 6.0
(Dec. 2022)
Config 3.0
Metrics 5.0
Fault Tolerance 4.0
Health 4.0
Rest Client 3.0
OpenAPI 3.1
Telemetry 1.0
JWT Auth 2.1
Jakarta EE 10 Core Profile
MicroProfile 6.1
(Oct. 2023)
Config 3.1
Metrics 5.1
Fault Tolerance 4.0
Health 4.0
Rest Client 3.0
OpenAPI 3.1
Telemetry 1.1
JWT Auth 2.1
Jakarta EE 10 Core
Profile
2023
MicroProfile
Health Metrics
Fault
Tolerance
Open API Config
Telemetry
JWT
Rest Client
GraphQL
Reactive
Streams
Operators
Reactive
Messaging
Context
Propagation
Platform Release
Standalone Release
Jakarta EE
Core Profile
LRA
Open Tracing
MicroProfile 6.1 in Oct. 2023
Health 4.0 Metrics 5.1
Fault
Tolerance 4.0
Open API 3.1 Config 3.1
Telemetry 1.1
JWT 2.1
Rest Client
3.0
Jakarta EE
10 Core
Profile
Updated specs Unchanged specs Jakarta EE 10 Core Profile specs
Core
Integrate
Observe
Agenda
01
02
03
9
IBM TechXchange / © 2023 IBM Corporation
MicroProfile background
MicroProfile Deep Dive
MicroProfile future
10
Use case: As a developer, I need to
create a microservice working in a
cloud.
Jakarta REST
B
@ApplicationPath("System")
public class SystemApplication extends
Application {}
@Path("properties")
public class PropertiesResource {
@GET
@Produces(MediaType.APPLICATION_JSON)
public JsonObject getProperties() {…}
}
12
I need to configure my services in
my deployment environment
A
MicroProfile Config
B
@Inject
@ConfigProperty(name = "inMaintenance")
private Provider<Boolean> inMaintenance;
config_ordinal=100
inMaintenance=false
{
"config_ordinal":150,
"inMaintenance":true
}
https://github.com/eclipse/microprofile-config/
14
I want to call other microservices
MicroProfile REST Client
B
A
@Inject
@RestClient
private SystemClient defaultRestClient;
@Dependent
@RegisterRestClient
@RegisterProvider(UnknownUrlExceptionMapper.class)
@Path("/properties")
public interface SystemClient {
@GET
@Produces(MediaType.APPLICATION_JSON)
public Properties getProperties() throws
UnknownUrlException, ProcessingException;
}
io.openliberty.guides.inventory.client.SystemClient/mp-rest/url=http://localhost:9080/system
https://github.com/eclipse/microprofile-rest-client
16
What does the service do?
MicroProfile OpenAPI
A B
openapi: 3.0.0
info:
title: Inventory App
description: App for storing JVM system properties of various
hosts.
license:
name: Eclipse Public License - v 1.0
url: https://www.eclipse.org/legal/epl-v10.html
version: "1.0"
servers: - url: http://localhost:{port} description: Simple Open
Liberty.
variables:
port:
description: Server HTTP port.
default: "9080"
paths:
/inventory/systems:
get:
summary: List inventory contents.
description: Returns the currently stored host:properties
pairs in the inventory.
operationId: listContents
responses:
200:
description: host:properties pairs stored in the inventory.
content:
application/json:
schema:
$ref: '#/components/schemas/InventoryList’
….
http://localhost:9080/openapi/ui
https://github.com/eclipse/microprofile-open-api/
18
I need to protect my services to
prevent from unauthorized access
MicroProfile JWT
A B
@GET
@RolesAllowed({ "admin", "user" })
@Path("{hostname}")
@Produces(MediaType.APPLICATION_JSON)
public Response getPropertiesForHost(@PathParam("hostname") String hostname,
@Context HttpHeaders httpHeaders) {…}
https://github.com/eclipse/microprofile-jwt-auth/
20
I need to provide a good response
to my clients no matter what
happens.
MicroProfile Fault Tolerance
A B
@Fallback(fallbackMethod = "fallbackForGet")
public Properties get(String hostname) throws IOException
{
return invUtils.getProperties(hostname);
}
https://github.com/eclipse/microprofile-fault-tolerance/
MicroProfile Fault Tolerance
– The annotations can be used together.
– When MicroProfile Metrics is enabled, their usages are monitored.
– The values can be configured via MicroProfile Config.
@Retry @Timeout @CircuitBreaker
@Bulkhead @Asynchronous @Fallback
23
I need to ensure they work in the
Cloud and observe them.
MicroProfile
Health Metrics
Fault
Tolerance
Open API Config
Telemetry
JWT
Rest Client
Jakarta EE
Core Profile
25
I need my service to communicate
with Kubernetes so that requests
can be routed when my service is
ready.
MicroProfile Health
A B
@Readiness
@ApplicationScoped
public class InventoryResource implements HealthCheck {
...
public boolean isHealthy() {...}
@Override
public HealthCheckResponse call() {
if (!isHealthy()) {
return
HealthCheckResponse.named(“ServiceHealthCheck”).withData(…).down().build();
}
return
HealthCheckResponse.named(“ServiceHealthCheck”).withData(…).up().build();
}
}
https://github.com/eclipse/microprofile-health/
MicroProfile Health 3.1
Startup Probe
Liveness Probe
Readiness Probe
mpHealth-3.1 feature Application provided health
checks
/health
/health/ready
/health/live
Health Check D
@Readiness
Health Check E
@Readiness
Health Check
C
@Liveness
/health/started
Health Check A
@Startup
Health Check B
@Startup
Application 1
HTTP GET
In Kubernetes, when the startup probe is
configured, the liveness and readiness checks
are disabled, until it succeeds.
Kubernetes
28
I need to know how my service is
performing.
MicroProfile Metrics
A B
@Timed(name = "inventoryPropertiesRequestTime”,
description = "Time needed to get the properties of" +
"a system from the given hostname")
public Properties get(String hostname) {
return invUtils.getProperties(hostname);
}
https://github.com/eclipse/microprofile-metrics/
MicroProfile Metrics 5.1
Influenced by Micrometer
All metrics are under /metrics endpoint.
Data is returned from /metrics calls in the Prometheus 0.0.4 exposition format.
Implementation can use Micrometer or OpenTelemetry Metrics
MicroProfile Metrics 5.1
Liberty mpMetrics-5.1
• Tracks metrics from Liberty components and the JVM to help you understand how your servers are performing.
• Provides the MicroProfile Metrics API, which you can use to add metrics to your applications.
• Provides the ability to group application metrics into custom scopes and allows querying of metrics by those scopes.
• Is based on Micrometer - can ship metrics to your choice of monitoring systems (currently including AppOptics, Azure Monitor, Netflix Atlas,
CloudWatch, Datadog, Dynatrace, Elastic, Ganglia, Graphite, Humio, Influx/Telegraf, JMX, KairosDB, New Relic, Prometheus, SignalFx,
Google Stackdriver, StatsD, and Wavefront.)
Micrometer and Prometheus meter registry included in
mpMetrics-5.0.
Provide other meter registries if you want to connect to a different
monitoring system.
32
I need to identify the root cause if
something goes wrong.
MicroProfile Telemetry
A B
@WithSpan(name=“list”)
public InventoryList list() {
return new InventoryList(systems);
}
Jakarta REST methods are
automatically traced by default
https://github.com/eclipse/microprofile-telemetry/
MicroProfile Telemetry
34
• Adopts OpenTelemetry Tracing
• Set of APIs, SDKs, tooling and integrations
• Designed for the creation and management of
telemetry data (traces, metrics, and logs)
• Supports 3 instrumentations:
• Manual
• Automatic
• Java Agent
MicroProfile Telemetry
• Support Java agent instrumentation
-javaagent:opentelemetry-javaagent.jar
-Dotel.service.name=<name>
-Dotel.traces.exporter=jaeger
-Dotel.instrumentation.opentelemetry-api.enabled=false
• Automatically tracing of REST (server and client) calls, and MicroProfile REST Client calls
without code modification.
• Manual instrumentation using OpenTelemetry API
–@WithSpan
–@SpanAttribute
–@Inject io.opentelemetry.api.OpenTelemetry
–@Inject io.opentelemetry.api.trace.Tracer
–@Inject io.opentelemetry.api.trace.Span
–@Inject io.opentelemetry.api.baggage.Baggage
java -javaagent:path/to/opentelemetry-javaagent.jar 
-Dotel.service.name=your-service-name 
-Dotel.traces.exporter=zipkin 
-jar myapp.jar
How MP Telemetry works
– https://openliberty.io/guides/microprofile-telemetry-jaeger.html
37
Done the development. Time to
deploy to my chosen Cloud. How to
do it?
Cloud-Native Application Deployment
Kubernetes Istio
Docker
or
Podman
Health Metrics
Fault
Tolerance
Open API Config
Open Tracing
JWT
Rest Client
Jakarta EE
Core Profile
MicroProfile Config with Kubernetes
A B
env:
- name: GREETING
valueFrom:
configMapKeyRef:
name: greeting-config
key: message
kubectl create configmap greeting-config --from-literal message=Hello...
@Inject
@ConfigProperty(name = "GREETING")
private String greeting;
MicroProfile Health with Kubernetes
A B
readinessProbe:
httpGet:
path: /health/ready
port: 9080
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 1
MicroProfile Metrics with Kubernetes
A B
@POST
@Counted(name="order", displayName="Order count",
description="Number of times orders requested.")
public Response orderCoffee(@Valid @NotNull CoffeeOrder order) {
...
}
Data in OpenMetrics
format
Collect and store data
with Prometheus
Visualize data with
Grafana
MicroProfile Telemetry
7 HTTP headers required by Istio propagated
All Jakarta REST
requests traced
Istio & MicroProfile - Putting it all together
44
I need to create a reactive
microservice.
MicroProfile Reactive Messaging
Reactive Messaging is based on Reactive Streams Operators
MicroProfile Reactive Messaging
The MicroProfile Reactive Messaging API provides a simple way to configure the streams and event queues
using annotations
– https://openliberty.io/guides/microprofile-reactive-messaging.html
MicroProfile Reactive Messaging 3.0
Imperative code bridges with reactive code
48
How to do transactions in
microservices? SAGA pattern?
MicroProfile LRA
• Cloud Native Transaction model based on compensating Saga model
• Loosely coupled µServices with eventually consistent data
LRA Coordinator
µS A µS B µS C
• Orchestration via a Coordinator Service that Participant
µServices registers with
• Annotations for joining, completing and compensating
transactions
MicroProfile LRA
Need to maintain data consistency across multiple µservices
where each has their own data.
The multiple operations form the atomic action which needs to be
process together
In the case of failures compensation actions are invoked
Flight
µS
Book
Taxi µS
Hotel
µS
Book Book
Flight
µS
Taxi µS
Hotel
µS
Confirm Confirm
Confirm
Start LRA
End LRA
Successful
Flight
µS
Book
Taxi µS
Hotel
µS
Book Book
Flight
µS
Book
Taxi µS
Hotel
µS
Book Book
Flight
µS
Taxi µS
Failed
Compensate
Compensate
Start LRA
End LRA
❌
Error
In the case of success, complete actions are invoked
51
I need to frequently query/update
data. What should I do?
MicroProfile GraphQL
• Avoiding over-fetching or under-fetching
data.
• Enabling data models to evolve, schema
driven.
• Provide a "code-first" set of APIs that will
enable users to quickly develop portable
GraphQL-based applications in Java
– GraphQL Entities
Scalars, or simple type
Enumerable types (similar to Java Enum)
Complex objects : scalars and/or enums and/or other complex objects and/or collections of these.
– GraphQL Components
– @GraphQLApi : GraphQL endpoints must be annotated with the @GraphQLApi annotation.
– @Query: allows a user to ask for all or specific fields on an object or collection of objects.
– @Mutation: create new entities or update or delete existing entities.
– https://openliberty.io/guides/microprofile-graphql.html
53
I am convinced to use MicroProfile.
Where to start?
How to get started?
https://start.microprofile.io/
Open Liberty Starter
https://start.openliberty.io
56
Are there any learning materials?
Learning materials
– https://openliberty.io/guides/?search=microprofile
– https://microprofile.io/
58
MicroProfile Book featured Open Liberty
https://ibm.biz/MicroProfileBook
Twitter/LinkedIn: @emilyfhjiang
Agenda
01
02
03
59
IBM TechXchange / © 2023 IBM Corporation
MicroProfile background
MicroProfile Deep Dive
MicroProfile future
MicroProfile in 2024
● MicroProfile 7.0 in 2Q 2024
○ Adopt OpenTelemetry Metrics in MicroProfile Telemetry 1.2/2.0
○ Move MicroProfile Metrics to be a standalone spec
○ Make Jakarta EE Core Profile dependency loosely coupled
○ Update other specifications accordingly
● New specifications
○ Evaluate a new specification: Converter
○ Evaluate a new specification: Serverless
60
61
Q&A
Emily Jiang
IBM, Cloud Native Architect & Advocate
emijiang@uk.ibm.com
Twitter/LinkedIn: @emilyfhjiang
62
Thank You
Emily Jiang
IBM, Cloud Native Architect and Advocate
emijiang@uk.ibm.com
X/LinkedIn: @emilyfhjiang
Master a Cloud Native Standard - MicroProfile.pptx

More Related Content

Similar to Master a Cloud Native Standard - MicroProfile.pptx

Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataWaheed Nazir
 
DevNexus 2019: MicroProfile and Jakarta EE - What's Next?
DevNexus 2019:  MicroProfile and Jakarta EE - What's Next?DevNexus 2019:  MicroProfile and Jakarta EE - What's Next?
DevNexus 2019: MicroProfile and Jakarta EE - What's Next?Kevin Sutter
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparisonEmily Jiang
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using GoCloudOps2005
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...Matt Raible
 
Android application architecture
Android application architectureAndroid application architecture
Android application architectureRomain Rochegude
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedToru Wonyoung Choi
 
Apache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San JoseApache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San JoseHao Chen
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugToshiaki Maki
 
The new and smart way to build microservices - Eclipse MicroProfile
The new and smart way to build microservices - Eclipse MicroProfileThe new and smart way to build microservices - Eclipse MicroProfile
The new and smart way to build microservices - Eclipse MicroProfileEmily Jiang
 
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...Martin Etmajer
 
Apache Eagle in Action
Apache Eagle in ActionApache Eagle in Action
Apache Eagle in ActionHao Chen
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...Matt Raible
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoringOracle Korea
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringDonghuKIM2
 
Spring training
Spring trainingSpring training
Spring trainingTechFerry
 
jRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting ServicejRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting ServiceGunnar Hillert
 
Red hat forum istio & kiali - introduction and overview
Red hat forum   istio & kiali - introduction and overviewRed hat forum   istio & kiali - introduction and overview
Red hat forum istio & kiali - introduction and overviewLiran Cohen
 

Similar to Master a Cloud Native Standard - MicroProfile.pptx (20)

Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveDataAndroid MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
Android MVVM architecture using Kotlin, Dagger2, LiveData, MediatorLiveData
 
DevNexus 2019: MicroProfile and Jakarta EE - What's Next?
DevNexus 2019:  MicroProfile and Jakarta EE - What's Next?DevNexus 2019:  MicroProfile and Jakarta EE - What's Next?
DevNexus 2019: MicroProfile and Jakarta EE - What's Next?
 
Cloud native programming model comparison
Cloud native programming model comparisonCloud native programming model comparison
Cloud native programming model comparison
 
Operator SDK for K8s using Go
Operator SDK for K8s using GoOperator SDK for K8s using Go
Operator SDK for K8s using Go
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Jforum S...
 
Android application architecture
Android application architectureAndroid application architecture
Android application architecture
 
Jetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO ExtendedJetpack, with new features in 2021 GDG Georgetown IO Extended
Jetpack, with new features in 2021 GDG Georgetown IO Extended
 
Apache Eagle: Secure Hadoop in Real Time
Apache Eagle: Secure Hadoop in Real TimeApache Eagle: Secure Hadoop in Real Time
Apache Eagle: Secure Hadoop in Real Time
 
Apache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San JoseApache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San Jose
 
Spring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsugSpring Cloud Function & Project riff #jsug
Spring Cloud Function & Project riff #jsug
 
The new and smart way to build microservices - Eclipse MicroProfile
The new and smart way to build microservices - Eclipse MicroProfileThe new and smart way to build microservices - Eclipse MicroProfile
The new and smart way to build microservices - Eclipse MicroProfile
 
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
Challenges in a Microservices Age: Monitoring, Logging and Tracing on Red Hat...
 
Apache Eagle in Action
Apache Eagle in ActionApache Eagle in Action
Apache Eagle in Action
 
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
Microservices for the Masses with Spring Boot, JHipster, and OAuth - Switzerl...
 
Spring boot microservice metrics monitoring
Spring boot   microservice metrics monitoringSpring boot   microservice metrics monitoring
Spring boot microservice metrics monitoring
 
Spring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics MonitoringSpring Boot - Microservice Metrics Monitoring
Spring Boot - Microservice Metrics Monitoring
 
Spring training
Spring trainingSpring training
Spring training
 
jRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting ServicejRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting Service
 
Red hat forum istio & kiali - introduction and overview
Red hat forum   istio & kiali - introduction and overviewRed hat forum   istio & kiali - introduction and overview
Red hat forum istio & kiali - introduction and overview
 
Android - Api & Debugging in Android
Android - Api & Debugging in AndroidAndroid - Api & Debugging in Android
Android - Api & Debugging in Android
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 

Master a Cloud Native Standard - MicroProfile.pptx

  • 1. Emily Jiang, Java Champion IBM, STSM, Cloud Native Architect and Advocate 16th November 2023 Master a Cloud Native Application Standard: MicroProfile
  • 6. MicroProfile 1.0 (Fall 2016) MicroProfile 1.1 (Aug. 2017) MicroProfile 1.2 (Sept 2017) 2017 2018 MicroProfile 1.3 (Dec 2017) MicroProfile 1.4 (June 2018) 2019 MicroProfile 2.0.1 (July 2018) MicroProfile 2.1 (Oct 2018) MicroProfile 2.2 (Feb 2019) MicroProfile 3.0 (June 2019) MicroProfile 3.2 (Nov 2019) 2020 MicroProfile 3.3 (Feb 2020) MicroProfile 4.0 (Oct. 2020) MicroProfile 4.1 (July. 2021) MicroProfile 5.0 (Dec. 2021) Config 3.0 Metrics 4.0 Fault Tolerance 4.0 Health 4.0 Rest Client 3.0 OpenAPI 3.0 OpenTracing 3.0 JWT Auth 2.0 Jakarta CDI 3.0 //Jakarta EE 9.1 Jakarta RESTful Web Services //Jakarta EE 9.1 Jakarta JSON-P //Jakarta EE 9.1 Jakarta JSON-B 2.0 //Jakarta EE 9.1 Jakarta Annotations 2.0 //Jakarta EE 9.1 2022 2021 MicroProfile 6.0 (Dec. 2022) Config 3.0 Metrics 5.0 Fault Tolerance 4.0 Health 4.0 Rest Client 3.0 OpenAPI 3.1 Telemetry 1.0 JWT Auth 2.1 Jakarta EE 10 Core Profile MicroProfile 6.1 (Oct. 2023) Config 3.1 Metrics 5.1 Fault Tolerance 4.0 Health 4.0 Rest Client 3.0 OpenAPI 3.1 Telemetry 1.1 JWT Auth 2.1 Jakarta EE 10 Core Profile 2023
  • 7. MicroProfile Health Metrics Fault Tolerance Open API Config Telemetry JWT Rest Client GraphQL Reactive Streams Operators Reactive Messaging Context Propagation Platform Release Standalone Release Jakarta EE Core Profile LRA Open Tracing
  • 8. MicroProfile 6.1 in Oct. 2023 Health 4.0 Metrics 5.1 Fault Tolerance 4.0 Open API 3.1 Config 3.1 Telemetry 1.1 JWT 2.1 Rest Client 3.0 Jakarta EE 10 Core Profile Updated specs Unchanged specs Jakarta EE 10 Core Profile specs Core Integrate Observe
  • 9. Agenda 01 02 03 9 IBM TechXchange / © 2023 IBM Corporation MicroProfile background MicroProfile Deep Dive MicroProfile future
  • 10. 10 Use case: As a developer, I need to create a microservice working in a cloud.
  • 11. Jakarta REST B @ApplicationPath("System") public class SystemApplication extends Application {} @Path("properties") public class PropertiesResource { @GET @Produces(MediaType.APPLICATION_JSON) public JsonObject getProperties() {…} }
  • 12. 12 I need to configure my services in my deployment environment
  • 13. A MicroProfile Config B @Inject @ConfigProperty(name = "inMaintenance") private Provider<Boolean> inMaintenance; config_ordinal=100 inMaintenance=false { "config_ordinal":150, "inMaintenance":true } https://github.com/eclipse/microprofile-config/
  • 14. 14 I want to call other microservices
  • 15. MicroProfile REST Client B A @Inject @RestClient private SystemClient defaultRestClient; @Dependent @RegisterRestClient @RegisterProvider(UnknownUrlExceptionMapper.class) @Path("/properties") public interface SystemClient { @GET @Produces(MediaType.APPLICATION_JSON) public Properties getProperties() throws UnknownUrlException, ProcessingException; } io.openliberty.guides.inventory.client.SystemClient/mp-rest/url=http://localhost:9080/system https://github.com/eclipse/microprofile-rest-client
  • 16. 16 What does the service do?
  • 17. MicroProfile OpenAPI A B openapi: 3.0.0 info: title: Inventory App description: App for storing JVM system properties of various hosts. license: name: Eclipse Public License - v 1.0 url: https://www.eclipse.org/legal/epl-v10.html version: "1.0" servers: - url: http://localhost:{port} description: Simple Open Liberty. variables: port: description: Server HTTP port. default: "9080" paths: /inventory/systems: get: summary: List inventory contents. description: Returns the currently stored host:properties pairs in the inventory. operationId: listContents responses: 200: description: host:properties pairs stored in the inventory. content: application/json: schema: $ref: '#/components/schemas/InventoryList’ …. http://localhost:9080/openapi/ui https://github.com/eclipse/microprofile-open-api/
  • 18. 18 I need to protect my services to prevent from unauthorized access
  • 19. MicroProfile JWT A B @GET @RolesAllowed({ "admin", "user" }) @Path("{hostname}") @Produces(MediaType.APPLICATION_JSON) public Response getPropertiesForHost(@PathParam("hostname") String hostname, @Context HttpHeaders httpHeaders) {…} https://github.com/eclipse/microprofile-jwt-auth/
  • 20. 20 I need to provide a good response to my clients no matter what happens.
  • 21. MicroProfile Fault Tolerance A B @Fallback(fallbackMethod = "fallbackForGet") public Properties get(String hostname) throws IOException { return invUtils.getProperties(hostname); } https://github.com/eclipse/microprofile-fault-tolerance/
  • 22. MicroProfile Fault Tolerance – The annotations can be used together. – When MicroProfile Metrics is enabled, their usages are monitored. – The values can be configured via MicroProfile Config. @Retry @Timeout @CircuitBreaker @Bulkhead @Asynchronous @Fallback
  • 23. 23 I need to ensure they work in the Cloud and observe them.
  • 24. MicroProfile Health Metrics Fault Tolerance Open API Config Telemetry JWT Rest Client Jakarta EE Core Profile
  • 25. 25 I need my service to communicate with Kubernetes so that requests can be routed when my service is ready.
  • 26. MicroProfile Health A B @Readiness @ApplicationScoped public class InventoryResource implements HealthCheck { ... public boolean isHealthy() {...} @Override public HealthCheckResponse call() { if (!isHealthy()) { return HealthCheckResponse.named(“ServiceHealthCheck”).withData(…).down().build(); } return HealthCheckResponse.named(“ServiceHealthCheck”).withData(…).up().build(); } } https://github.com/eclipse/microprofile-health/
  • 27. MicroProfile Health 3.1 Startup Probe Liveness Probe Readiness Probe mpHealth-3.1 feature Application provided health checks /health /health/ready /health/live Health Check D @Readiness Health Check E @Readiness Health Check C @Liveness /health/started Health Check A @Startup Health Check B @Startup Application 1 HTTP GET In Kubernetes, when the startup probe is configured, the liveness and readiness checks are disabled, until it succeeds. Kubernetes
  • 28. 28 I need to know how my service is performing.
  • 29. MicroProfile Metrics A B @Timed(name = "inventoryPropertiesRequestTime”, description = "Time needed to get the properties of" + "a system from the given hostname") public Properties get(String hostname) { return invUtils.getProperties(hostname); } https://github.com/eclipse/microprofile-metrics/
  • 30. MicroProfile Metrics 5.1 Influenced by Micrometer All metrics are under /metrics endpoint. Data is returned from /metrics calls in the Prometheus 0.0.4 exposition format. Implementation can use Micrometer or OpenTelemetry Metrics
  • 31. MicroProfile Metrics 5.1 Liberty mpMetrics-5.1 • Tracks metrics from Liberty components and the JVM to help you understand how your servers are performing. • Provides the MicroProfile Metrics API, which you can use to add metrics to your applications. • Provides the ability to group application metrics into custom scopes and allows querying of metrics by those scopes. • Is based on Micrometer - can ship metrics to your choice of monitoring systems (currently including AppOptics, Azure Monitor, Netflix Atlas, CloudWatch, Datadog, Dynatrace, Elastic, Ganglia, Graphite, Humio, Influx/Telegraf, JMX, KairosDB, New Relic, Prometheus, SignalFx, Google Stackdriver, StatsD, and Wavefront.) Micrometer and Prometheus meter registry included in mpMetrics-5.0. Provide other meter registries if you want to connect to a different monitoring system.
  • 32. 32 I need to identify the root cause if something goes wrong.
  • 33. MicroProfile Telemetry A B @WithSpan(name=“list”) public InventoryList list() { return new InventoryList(systems); } Jakarta REST methods are automatically traced by default https://github.com/eclipse/microprofile-telemetry/
  • 34. MicroProfile Telemetry 34 • Adopts OpenTelemetry Tracing • Set of APIs, SDKs, tooling and integrations • Designed for the creation and management of telemetry data (traces, metrics, and logs) • Supports 3 instrumentations: • Manual • Automatic • Java Agent
  • 35. MicroProfile Telemetry • Support Java agent instrumentation -javaagent:opentelemetry-javaagent.jar -Dotel.service.name=<name> -Dotel.traces.exporter=jaeger -Dotel.instrumentation.opentelemetry-api.enabled=false • Automatically tracing of REST (server and client) calls, and MicroProfile REST Client calls without code modification. • Manual instrumentation using OpenTelemetry API –@WithSpan –@SpanAttribute –@Inject io.opentelemetry.api.OpenTelemetry –@Inject io.opentelemetry.api.trace.Tracer –@Inject io.opentelemetry.api.trace.Span –@Inject io.opentelemetry.api.baggage.Baggage java -javaagent:path/to/opentelemetry-javaagent.jar -Dotel.service.name=your-service-name -Dotel.traces.exporter=zipkin -jar myapp.jar
  • 36. How MP Telemetry works – https://openliberty.io/guides/microprofile-telemetry-jaeger.html
  • 37. 37 Done the development. Time to deploy to my chosen Cloud. How to do it?
  • 38. Cloud-Native Application Deployment Kubernetes Istio Docker or Podman Health Metrics Fault Tolerance Open API Config Open Tracing JWT Rest Client Jakarta EE Core Profile
  • 39. MicroProfile Config with Kubernetes A B env: - name: GREETING valueFrom: configMapKeyRef: name: greeting-config key: message kubectl create configmap greeting-config --from-literal message=Hello... @Inject @ConfigProperty(name = "GREETING") private String greeting;
  • 40. MicroProfile Health with Kubernetes A B readinessProbe: httpGet: path: /health/ready port: 9080 initialDelaySeconds: 15 periodSeconds: 5 failureThreshold: 1
  • 41. MicroProfile Metrics with Kubernetes A B @POST @Counted(name="order", displayName="Order count", description="Number of times orders requested.") public Response orderCoffee(@Valid @NotNull CoffeeOrder order) { ... } Data in OpenMetrics format Collect and store data with Prometheus Visualize data with Grafana
  • 42. MicroProfile Telemetry 7 HTTP headers required by Istio propagated All Jakarta REST requests traced
  • 43. Istio & MicroProfile - Putting it all together
  • 44. 44 I need to create a reactive microservice.
  • 45. MicroProfile Reactive Messaging Reactive Messaging is based on Reactive Streams Operators
  • 46. MicroProfile Reactive Messaging The MicroProfile Reactive Messaging API provides a simple way to configure the streams and event queues using annotations – https://openliberty.io/guides/microprofile-reactive-messaging.html
  • 47. MicroProfile Reactive Messaging 3.0 Imperative code bridges with reactive code
  • 48. 48 How to do transactions in microservices? SAGA pattern?
  • 49. MicroProfile LRA • Cloud Native Transaction model based on compensating Saga model • Loosely coupled µServices with eventually consistent data LRA Coordinator µS A µS B µS C • Orchestration via a Coordinator Service that Participant µServices registers with • Annotations for joining, completing and compensating transactions
  • 50. MicroProfile LRA Need to maintain data consistency across multiple µservices where each has their own data. The multiple operations form the atomic action which needs to be process together In the case of failures compensation actions are invoked Flight µS Book Taxi µS Hotel µS Book Book Flight µS Taxi µS Hotel µS Confirm Confirm Confirm Start LRA End LRA Successful Flight µS Book Taxi µS Hotel µS Book Book Flight µS Book Taxi µS Hotel µS Book Book Flight µS Taxi µS Failed Compensate Compensate Start LRA End LRA ❌ Error In the case of success, complete actions are invoked
  • 51. 51 I need to frequently query/update data. What should I do?
  • 52. MicroProfile GraphQL • Avoiding over-fetching or under-fetching data. • Enabling data models to evolve, schema driven. • Provide a "code-first" set of APIs that will enable users to quickly develop portable GraphQL-based applications in Java – GraphQL Entities Scalars, or simple type Enumerable types (similar to Java Enum) Complex objects : scalars and/or enums and/or other complex objects and/or collections of these. – GraphQL Components – @GraphQLApi : GraphQL endpoints must be annotated with the @GraphQLApi annotation. – @Query: allows a user to ask for all or specific fields on an object or collection of objects. – @Mutation: create new entities or update or delete existing entities. – https://openliberty.io/guides/microprofile-graphql.html
  • 53. 53 I am convinced to use MicroProfile. Where to start?
  • 54. How to get started? https://start.microprofile.io/
  • 56. 56 Are there any learning materials?
  • 58. 58 MicroProfile Book featured Open Liberty https://ibm.biz/MicroProfileBook Twitter/LinkedIn: @emilyfhjiang
  • 59. Agenda 01 02 03 59 IBM TechXchange / © 2023 IBM Corporation MicroProfile background MicroProfile Deep Dive MicroProfile future
  • 60. MicroProfile in 2024 ● MicroProfile 7.0 in 2Q 2024 ○ Adopt OpenTelemetry Metrics in MicroProfile Telemetry 1.2/2.0 ○ Move MicroProfile Metrics to be a standalone spec ○ Make Jakarta EE Core Profile dependency loosely coupled ○ Update other specifications accordingly ● New specifications ○ Evaluate a new specification: Converter ○ Evaluate a new specification: Serverless 60
  • 61. 61 Q&A Emily Jiang IBM, Cloud Native Architect & Advocate emijiang@uk.ibm.com Twitter/LinkedIn: @emilyfhjiang
  • 62. 62 Thank You Emily Jiang IBM, Cloud Native Architect and Advocate emijiang@uk.ibm.com X/LinkedIn: @emilyfhjiang