Functional microservices with JavaEE V´ıctor Orozco - @tuxtor February 22, 2018 GuateJUG 1
About • SW Developer/Engi- neer/Architect • Oracle Workforce Trainer/Edx Micromasters • Jug Leader GuateJUG • @tuxtor • http://vorozco.com 2
Zen State Zen = Stakeholders don’t call you, unless it’s your birthday • Productivity • HR Availability • Stability and predictability • Scalability • Money 3
Zen State Some sprints ago I had ”birthdays” on daily basis 4
How my birthdays started Please V´ıctor help us to do Microservices 5
!Birthday Please V´ıctor help us to choose a well known language, with a well known framework, for achieving great stability, spending the least money, and take advantage of our existing codebase. 6
Lesson 1: Microservices are a mindset revolution
Monolith Figure 1: Regular monolith - Credits: Markus Eisele 7
ESB Figure 2: ESB - Credits: Markus Eisele 8
Microservices Figure 3: Microservices - Credits: Markus Eisele 9
Microservices Advantages • Small codebases • Better software practices • Fault tolerance • Scalability Disadvantages • Tooling overhead • Debugging • Distributed transactions • Latency • Dependency 10
Microservices Disadvantages Hype Driven Development 11
Lesson 2: Functional Microservices are not the same for everybody
How POC from Sr. to Jr. • Vert.x • Spring Boot • DropWizard • Akka • NodeJS . . . • JavaEE 12
J2EE Jobs J2EE Guatemala 2018 13
HR • From the top five universities at country only three teach Java properly • The other two teach .NET • Sillicon Valley off-shores take best developers 14
Lesson 3: You don’t need to be 100% ”microservice compliant”
Microservices - JavaEE JavaEE is one of the most anti-hype frameworks J2EE 1.2 (December 12, 1999) 15
Microservices - JavaEE Implementation • Iterative refactoring - Do it by waves • Practical refactoring - Extract an already existing service • New services - New services talk to monolith 16
Microservices - JavaEE Figure 4: JavaEE technologies - Credits: Reza Rahman 17
Microservices - JavaEE 18
Microservices - JavaEE 19
Microservices - JavaEE 20
Microservices - Implementations • Wildfly Swarm • KumuluzEE • Open Liberty • TomEE • Payara Micro 21
Microservices - Payara Current target: Microprofile 1.2 • Microprofile 1.2 • JavaEE Web Profile • JCache New deployments • Micro JavaEE server (CLI) • Uber-Jar/Fat-Jar 22
Demo
JavaEE Micro - Demo Java 8, JAX-RS, CDI, EJB, Microprofile https://github.com/tuxtor/payara-demo https://github.com/tuxtor/omdb-demo 23
Payara Micro - Traditional JavaEE Granted • EJB • JTA • JAX-RS • CDI 24
Payara Micro - Micro JavaEE MicroProfile: JAX-RS, CDI (Per service), Config, Fault Tolerance Implementation: EJB, JTA (Per service) Todo: Location, Deployment, Orchestation, Balancing, Consistency, Patterns 25
Config @Inject @ConfigProperty (name = "omdbservice.url") String omdbDaemonServiceUrl ; 26
Fault tolerance • Circuit Breaker • Bulkhead • Fallback • Retry • Timeout 27
Fault tolerance - Fallback, Timeout @GET @Path("/{id:[a-z]*[0 -9][0 -9]*}") @Fallback(fallbackMethod = " findByIdFallBack ") @Timeout(TIMEOUT) public Response findById(@PathParam("id") final String imdbId) { ... } public Response findByIdFallBack (@PathParam("id") final String imdbId) { ... } 28
Thank you • me@vorozco.com • http://vorozco.com • http://github.com/tuxtor/slides This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Guatemala License. 29

Functional microservices with Java EE