Gradual migration Java EE
to MicroProfile
What You’ll Learn Today
• Relation between Java EE, MicroProfile,…
• MicroProfile implementations overview
• Using MicroProfile
• Some examples in how migration can be done
Rudy De Busscher
• Payara
• Service team
• JSR-375
• Java EE Security API Expert group member
• Committer in Eclipse EE4J groups
• Java EE Believer
@rdebusscher
https://blog.payara.fish/
https://www.atbash.be
AGENDA
Today’s Challenges
Migration options
Plain Java EE Servers
Pimped Java EE Servers
Code
Java EE
• Backwards compatible enterprise apps
• Long term projects
• Also popular under start-ups
• Focus on business logic
• Slowly moving
• Not your silver bullet
Java EE 8 contents
From Oracle Blog
Arch
MicroServices
• Vaguely defined
• Not about size
• Service per domain
• Independently deployable
• Architectural style
• Not your silver bullet
MicroServices topology
Ops
• Fat Jar
• Application + Server code in 1 file
• Web Artifact (WAR, …)
• Application deployable on multiple implementations
• Hollow jar
• Server code in 1 file; runs your WAR
• Containerized
• Run your Server + App easy on multiple OS with lightweight VM.
Deployment style
Best Pract
1. Codebase: One codebase tracked in revision control, many deploys
2. Dependencies: Explicitly declare and isolate dependencies
3. Config: Store config in the environment
4. Backing services: Treat backing services as attached resources
5. Build, release, run: Strictly separate build and run stages
6. Processes: Execute the app as one or more stateless processes
7. Port binding: Export services via port binding
8. Concurrency: Scale out via the process model
9. Disposability: Maximize robustness with fast startup and graceful shutdown
10. Dev/prod parity: Keep development, staging, and production as similar as
possible
11. Logs: Treat logs as event streams
12. Admin processes: Run admin/management tasks as one-off processes
12 factor app
Arch
Best Pract
• Asynchronous data streams
• Events
• Hot/Cold (active/Inactive)
• Asynchronous IO (non blocking)
Reactive
Reactive concepts
From Reactive Manifesto
Today’s challenges
Code
MicroProfile
• Adds a few missing things to Java EE
• Makes Java EE more MicroService-ish
• Config, Rest invocation, Security, Tracing, Metrics, Non-
blocking
• MicroProfile can make your Java EE application
more MicroService-ish and compliant with the 12
Factor and reactive approach.
MP Goal
AGENDA
Today’s Challenges
Migration options
Plain Java EE Servers
Pimped Java EE Servers
Migration ?
• Gradual
• Large (monolith) app
• MicroServices
MicroProfile implementations
• Dedicated ‘Server’ implementations
• KumuluzEE, Hammock, Launcher
• Recently Thorntail v4, Helidon
MicroProfile implementations
• Individual frameworks
• Like SmallRye, Apache (Geronimo) umbrella
• Added to classic Java EE servers.
• Payara, OpenLiberty, (TomEE, WildFly)
Migration Options
1. Using classic servers
2. Use MP containing Java EE servers
Demo app
Mortgage
Start from
• Java EE
• Monolith
• JSF Front
• CDI services
Demo
AGENDA
Today’s Challenges
Migration options
Plain Java EE Servers
Pimped Java EE Servers
Option 1
• Java EE server
• No MicroProfile implementations available
• Ex WebLogic
• Add MP spec implementation(s) to server
• Adding to WAR not option
• Most use CDI extensions
• Result in class loading issues in impl code in JAR.
MP Impl in demo = KumuluzEE
Option 1 Overview
Demo
Option 1 issues
• Issues
• CDI injection not always work properly
• Use programmatic lookup
• Goals met
• Easier config of external services
• Call Rest endpoints easier
• Add automatically some filters
• Metrics
• Tracing
• Authentication
• Standalone implementations
• Apache CXF
• SmallRye Rest client
MP Rest Client
• Standalone implementation vs Java EE servers
• Bring their own Rest client
• Clashes with server defined one
• Atbash Rest Client uses the available client
• Not certified / fully compatible
• Workaround
MP Rest client issues
Demo
• All ‘services’ separated
• Front end can be rewritten
• Use of uber jars
• Example
• Thorntail v2 (nee WildFly Swarm)
Decomposed
MP lmpl in demo = Thorntail v2
Option 1 decomposed
AGENDA
Today’s Challenges
Migration options
Plain Java EE Servers
Pimped Java EE Servers
Option 2
• Use Java EE server
• Which has MP implementations on board
• Example
• OpenLiberty
• Payara Server
Advantage
• Less different servers used
• MP Perfectly integrated
• Use any mixture of traditional Java EE and MicroServices
(MP)
demo = Payara Micro
Option 2 decomposed
Demo
Take aways
• MicroProfile brings current best practices and modern
architectural styles into Java EE/Jakarta EE
• Can be used on any Java EE server (with limitations)
• Allows gradual adaptation of your app (no big bang)
• More and more Java EE servers incorporate it.
Code
• Demo applications
• https://github.com/rdebusscher/gradual-migration-mp
• Atbash Rest Client
• https://github.com/atbashEE/atbash-rest-client
Q & A
Thank You
Not using the Payara Platform yet? Download the open
source software: Payara Server or Payara Micro
https://payara.fish/downloads


Need support for the Payara Platform?
https://payara.fish/support

Gradual Migration to MicroProfile

  • 1.
    Gradual migration JavaEE to MicroProfile
  • 2.
    What You’ll LearnToday • Relation between Java EE, MicroProfile,… • MicroProfile implementations overview • Using MicroProfile • Some examples in how migration can be done
  • 3.
    Rudy De Busscher •Payara • Service team • JSR-375 • Java EE Security API Expert group member • Committer in Eclipse EE4J groups • Java EE Believer @rdebusscher https://blog.payara.fish/ https://www.atbash.be
  • 4.
    AGENDA Today’s Challenges Migration options PlainJava EE Servers Pimped Java EE Servers
  • 5.
    Code Java EE • Backwardscompatible enterprise apps • Long term projects • Also popular under start-ups • Focus on business logic • Slowly moving • Not your silver bullet
  • 6.
    Java EE 8contents From Oracle Blog
  • 7.
    Arch MicroServices • Vaguely defined •Not about size • Service per domain • Independently deployable • Architectural style • Not your silver bullet
  • 8.
  • 9.
    Ops • Fat Jar •Application + Server code in 1 file • Web Artifact (WAR, …) • Application deployable on multiple implementations • Hollow jar • Server code in 1 file; runs your WAR • Containerized • Run your Server + App easy on multiple OS with lightweight VM. Deployment style
  • 10.
    Best Pract 1. Codebase:One codebase tracked in revision control, many deploys 2. Dependencies: Explicitly declare and isolate dependencies 3. Config: Store config in the environment 4. Backing services: Treat backing services as attached resources 5. Build, release, run: Strictly separate build and run stages 6. Processes: Execute the app as one or more stateless processes 7. Port binding: Export services via port binding 8. Concurrency: Scale out via the process model 9. Disposability: Maximize robustness with fast startup and graceful shutdown 10. Dev/prod parity: Keep development, staging, and production as similar as possible 11. Logs: Treat logs as event streams 12. Admin processes: Run admin/management tasks as one-off processes 12 factor app
  • 11.
    Arch Best Pract • Asynchronousdata streams • Events • Hot/Cold (active/Inactive) • Asynchronous IO (non blocking) Reactive
  • 12.
  • 13.
  • 14.
    Code MicroProfile • Adds afew missing things to Java EE • Makes Java EE more MicroService-ish • Config, Rest invocation, Security, Tracing, Metrics, Non- blocking
  • 15.
    • MicroProfile canmake your Java EE application more MicroService-ish and compliant with the 12 Factor and reactive approach. MP Goal
  • 16.
    AGENDA Today’s Challenges Migration options PlainJava EE Servers Pimped Java EE Servers
  • 17.
    Migration ? • Gradual •Large (monolith) app • MicroServices
  • 18.
    MicroProfile implementations • Dedicated‘Server’ implementations • KumuluzEE, Hammock, Launcher • Recently Thorntail v4, Helidon
  • 19.
    MicroProfile implementations • Individualframeworks • Like SmallRye, Apache (Geronimo) umbrella • Added to classic Java EE servers. • Payara, OpenLiberty, (TomEE, WildFly)
  • 20.
    Migration Options 1. Usingclassic servers 2. Use MP containing Java EE servers
  • 21.
  • 22.
    Start from • JavaEE • Monolith • JSF Front • CDI services
  • 23.
  • 24.
    AGENDA Today’s Challenges Migration options PlainJava EE Servers Pimped Java EE Servers
  • 25.
    Option 1 • JavaEE server • No MicroProfile implementations available • Ex WebLogic • Add MP spec implementation(s) to server • Adding to WAR not option • Most use CDI extensions • Result in class loading issues in impl code in JAR.
  • 26.
    MP Impl indemo = KumuluzEE Option 1 Overview
  • 27.
  • 28.
    Option 1 issues •Issues • CDI injection not always work properly • Use programmatic lookup • Goals met • Easier config of external services
  • 29.
    • Call Restendpoints easier • Add automatically some filters • Metrics • Tracing • Authentication • Standalone implementations • Apache CXF • SmallRye Rest client MP Rest Client
  • 30.
    • Standalone implementationvs Java EE servers • Bring their own Rest client • Clashes with server defined one • Atbash Rest Client uses the available client • Not certified / fully compatible • Workaround MP Rest client issues
  • 31.
  • 32.
    • All ‘services’separated • Front end can be rewritten • Use of uber jars • Example • Thorntail v2 (nee WildFly Swarm) Decomposed
  • 33.
    MP lmpl indemo = Thorntail v2 Option 1 decomposed
  • 34.
    AGENDA Today’s Challenges Migration options PlainJava EE Servers Pimped Java EE Servers
  • 35.
    Option 2 • UseJava EE server • Which has MP implementations on board • Example • OpenLiberty • Payara Server
  • 36.
    Advantage • Less differentservers used • MP Perfectly integrated • Use any mixture of traditional Java EE and MicroServices (MP)
  • 37.
    demo = PayaraMicro Option 2 decomposed
  • 38.
  • 39.
    Take aways • MicroProfilebrings current best practices and modern architectural styles into Java EE/Jakarta EE • Can be used on any Java EE server (with limitations) • Allows gradual adaptation of your app (no big bang) • More and more Java EE servers incorporate it.
  • 40.
    Code • Demo applications •https://github.com/rdebusscher/gradual-migration-mp • Atbash Rest Client • https://github.com/atbashEE/atbash-rest-client
  • 41.
  • 42.
    Thank You Not usingthe Payara Platform yet? Download the open source software: Payara Server or Payara Micro https://payara.fish/downloads 
 Need support for the Payara Platform? https://payara.fish/support