1. 1
Cloud Native Microservice with
MicroProfile, Docker,
Kubernetes, Istio and OpenShift
Emily Jiang, Java Champion
Senior Technical Staff Member, IBM
Liberty Microservice Architect, Advocate
Senior Lead in MicroProfile, IBM
@emilyfhjiang
2. 2
Agenda
• Introduction to MicroProfile
• Introduction to Open Liberty
• Introduction to the Lab
• Summary
• Time to code!
4. 4
MicroProfile Community
● Over a dozen vendors and Java
user groups
● Around 169 individual
contributors and growing
● Around a dozen independent
implementations
5. 5
Open specifications
Wide vendor support
REST Client
OpenAPI support
Security
Fault Tolerance
Configuration
Metrics
Health
Open Tracing
https://wiki.eclipse.org/MicroProfile/Implementation
Quarkus
19. 19
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
20. 20
MicroProfile JWT
A B
@GET
@RolesAllowed({ "admin", "user" })
@Path("{hostname}")
@Produces(MediaType.APPLICATION_JSON)
public Response getPropertiesForHost(@PathParam("hostname") String hostname,
@Context HttpHeaders httpHeaders) {…}
21. 21
MicroProfile Fault Tolerance
A B
@Fallback(fallbackMethod = "fallbackForGet")
public Properties get(String hostname) throws
IOException {
return invUtils.getProperties(hostname);
}
24. 24
Handling 100s of collaborating services requires a strong operations
focus
25. 25
Eclipse MicroProfile
Health Check Metrics Open Tracing
microprofile.io
JAX-RS JSON-PCDI
Config
Fault
Tolerance
JWT
Propagation
Open API
Rest Client JSON-B
26. 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();
}
}
27. 27
MicroProfile Metrics
A B
@Timed(name = "inventoryPropertiesRequestTime",
absolute = true,
description = "Time needed to get the properties of" +
"a system from the given hostname")
public Properties get(String hostname) {
return invUtils.getProperties(hostname);
}
28. 28
MicroProfile OpenTracing
A B
@Traced(value = true, operationName = "InventoryManager.list")
public InventoryList list() {
return new InventoryList(systems);
}
JAX-RS methods are
automatically
traced by default
36. 36
MicroProfile Health with Kubernetes
A B
readinessProbe:
httpGet:
path: /health/ready
port: 9080
initialDelaySeconds: 15
periodSeconds: 5
failureThreshold: 1
42. 42
Summary
• MicroProfile - Java APIs for cloud-native applications
o Produce and consume REST services
o Handle faults, security, configuration, APIs
o Monitor health, metrics and trace request flows
• Open Liberty - Java platform for cloud-native applications
o Open Source, Simple, Lightweight, Fast
o Supports latest MicroProfile and Java EE APIs
o Flexible package to suit your Microservices