for a microservices architecture optimizing enterprise java ...microprofile background began as a...

23
Optimizing Enterprise Java for a Microservices Architecture Otávio Santana @otaviojava [email protected]

Upload: others

Post on 11-Oct-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Optimizing Enterprise Javafor a Microservices Architecture

Otávio Santana@otaviojava

[email protected]

Page 2: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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

Page 3: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

● JCP Members● JCP EC● JSR ● Standards

Page 4: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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

Page 5: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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

Page 6: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Profile

Page 7: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

MicroProfile Release Philosophy

Release 1.0

JAX-RSCDI

JSON-P

Buildconsensus Standardize

Rapidly iterateand innovate

Sept 2016

Page 8: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Bridging Community and Standards

Vendor Choice

Implementation Choice

Application Portability

Backwards Compatibility

Reduced Risk

Broad Collaboration

Encouraged experimentation

Fail Fast

Rapid innovation

Page 9: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

An Eclipse FoundationProject

● Meritocracy; vendor neutrality● MicroProfile leadership can change over

time● Legal and technical infrastructure● Trademark Ownership● Accepts Apache License

Page 10: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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!

Page 11: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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;}

Page 12: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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()); } }

Page 13: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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() { [...] }}

Page 14: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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);

Page 15: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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

Page 16: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

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

Page 17: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Release Schedule

Sep 2016

MicroProfile1.0

Q4 2016 2017 2017

Move toFoundation

MicroProfile1.1

MicroProfile1.2

Page 18: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

TomEE

Page 19: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

DEMO

Page 20: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Join the Community!

Page 21: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Join the Discussion!https://groups.google.com/forum/#!forum/microprofile

Page 22: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Resources● MicroProfile.io

● MicroProfile Discussion Forumbit.ly/MicroProfileForum

● MicroProfile Exampleshttps://github.com/microprofile/microprofile-samples

Page 23: for a Microservices Architecture Optimizing Enterprise Java ...MicroProfile Background Began as a collection of independent discussions Many innovative “microservices” efforts

Otávio Santana@otaviojava

[email protected]