for a microservices architecture optimizing enterprise java ...microprofile background began as a...
TRANSCRIPT
Optimizing Enterprise Javafor a Microservices Architecture
Otávio Santana@otaviojava
Enterprise Java Standards History
J2EE 1.2 J2EE 1.3 J2EE 1.4 Java EE 5 Java EE 6 Java EE 7 Java EE 8
2000 2005 2010 2015 2020ReleaseCadence
● JCP Members● JCP EC● JSR ● Standards
Fundamental Shifts in Computing
● Deliver new features more quickly● Smaller, more agile teams● Deliver business features as discrete services● Scale services independently
● Reduce time to market● Address unpredictable loads● Pay as you go● Containerization
Cloud
Microservices
MicroProfile Background● Began as a collection of independent discussions
○ Many innovative “microservices” efforts in existing Java EE projects■ WildFly Swarm■ WebSphere Liberty■ Payara■ TomEE
○ Projects already leveraging both Java EE and non-Java EE technologies○ Creating new features/capabilities to address microservices architectures
● Quickly realized there is common ground
● Java EE technologies are already being used for microservices,but we can do better
Profile
MicroProfile Release Philosophy
Release 1.0
JAX-RSCDI
JSON-P
Buildconsensus Standardize
Rapidly iterateand innovate
Sept 2016
Bridging Community and Standards
Vendor Choice
Implementation Choice
Application Portability
Backwards Compatibility
Reduced Risk
Broad Collaboration
Encouraged experimentation
Fail Fast
Rapid innovation
An Eclipse FoundationProject
● Meritocracy; vendor neutrality● MicroProfile leadership can change over
time● Legal and technical infrastructure● Trademark Ownership● Accepts Apache License
MicroProfile 1.1 Underway
Security: JWT Token Exchange 1.0
Health Check 1.0
Configuration 1.0
Fault Tolerance 1.0 (Stretch goal)
Second Quarter2017!
Configuration 1.0@ApplicationScopedpublic class InjectedConfigUsageSample {
@Inject private Config config;
@Inject @ConfigProperty(name="myprj.some.url") private String someUrl;
@Inject @ConfigProperty(name="myprj.some.port") private Optional<Integer> somePort;
@Inject @ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100") private javax.inject.Provider<Long> timeout;}
Security: JWT Token Exchange 1.0
@Priority(Priorities.AUTHENTICATION)public class JWTAuthFilter implements ContainerRequestFilter{
@Override public void filter(ContainerRequestContext requestContext) throws IOException { String authHeaderVal = requestContext.getHeaderString("Authorization"); if(authHeaderVal.startsWith("Bearer")){ try { validate(authHeaderVal.split(" ")[1]); } catch (InvalidJwtException ex) { requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).build()); } }else{ requestContext.abortWith(Response.status(Response.Status.UNAUTHORIZED).build()); } }
Health Check 1.0
@Path("/app")public class HealthCheckResource {
@GET @Path("/diskspace") @Health public HealthStatus checkDiskspace() { [...] }
@GET @Path("/something-else") @Health public HealthStatus checkSomethingElse() { [...] }}
@ApplicationScopedpublic class HealthChecks {
@Produces @Health public HealthStatus checkDiskspace() { [...] }
@Produces @Health public HealthStatus checkSomethingElse() { [...] }}
Fault Tolerance 1.0 (Stretch goal)
@ApplicationScopedpublic class FaultToleranceBean {
@Retry(maxRetries = 2) public Runnable doWork() { Runnable mainService = () -> serviceA(); return mainService;
}}}
CircuitBreaker cb = FaultToleranceFactory.getInstance(CircuitBreaker.class) .withFailureThreshold(3, 10) .withSuccessThreshold(5) .withDelay(1, TimeUnit.MINUTES);Connection connect = execution.with(cb).run(this::connect);
Feature Backlog* - Help us prioritize [1 of 2]
● Container API● Microservic-y annotations
(Ex: @CircuitBreaker)● Testing● Distributed Logging● Distributed Tracing● OAuth2/OpenID Connect● Microservice Security● Service Discovery● Health Check
● Configuration● Metrics/Monitoring● WebSockets● JSON-B● Bean Validation● JPA● JTA● Concurrency Utilities for
Java EE
* Some Items may be removed due to lack of interest
Feature Backlog* - Help us prioritize [2 of 2]
● Messaging / Eventing● Asynchronous/Reactive
Support / Patterns● Integration with Reactive /
Eventing systems● Big Data/NoSQL strong &
weak consistency support● NetFlix OSS Integration● JCache
● JDK 8 Lambda+Streams
● EJB Lite● Servlets● HTTP/2● Startup Time● Disk Space● Memory● Uber-jar● Java 9 Modularity
* Some Items may be removed due to lack of interest
Release Schedule
Sep 2016
MicroProfile1.0
Q4 2016 2017 2017
Move toFoundation
MicroProfile1.1
MicroProfile1.2
TomEE
DEMO
Join the Community!
Join the Discussion!https://groups.google.com/forum/#!forum/microprofile
Resources● MicroProfile.io
● MicroProfile Discussion Forumbit.ly/MicroProfileForum
● MicroProfile Exampleshttps://github.com/microprofile/microprofile-samples
Otávio Santana@otaviojava