Java EE Microservices with WIldFly Swarm John Clingan Senior Principle Product Manager
INSERT DESIGNATOR, IF NEEDED2 ● 19 year OCJUG member ● Java developer since 1996 ● Ex-GlassFish and Ex-Java EE Product Manager (Sun & Oracle) ○ Java EE 6 - Java EE 8 (Planning) ● Product Manager @ Red Hat for next-gen platforms ● Java EE 7 Instructor at UC Irvine Extension Who Am I
INSERT DESIGNATOR, IF NEEDED Microservices Defined 3 Pick a definition
INSERT DESIGNATOR, IF NEEDED4 Microservices Defined Two Pizza teams
INSERT DESIGNATOR, IF NEEDED5 “In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.” - Martin Fowler, ThoughtWorks Microservices Defined
INSERT DESIGNATOR, IF NEEDED6 GOAL Agility / Velocity
INSERT DESIGNATOR, IF NEEDED7 Pause - Switch to MicroProfile
INSERT DESIGNATOR, IF NEEDED8 Are you Ready for Microservices?
INSERT DESIGNATOR, IF NEEDED9 ● Basecamp ○ Millions of users ○ 200 controllers with 900 methods plus … ○ … 190 classes with 1473 methods ○ Happy with their approach The Majestic Monolith But first, a message from the “dark side” “Every time you extract a collaboration between objects to a collaboration between systems, you’re accepting a world of hurt with a myriad of liabilities and failure states.” Link: http://bit.ly/MajesticMonolith
INSERT DESIGNATOR, IF NEEDED10 Java EE Microservices
INSERT DESIGNATOR, IF NEEDED Java EE 7 APIs 11
Traditional Java EE Application Server Management
INSERT DESIGNATOR, IF NEEDED Architecture vs API vs Implementation 13 Microservices is an architectural approach Java EE is a set of API specifications enabling the community to innovate on implementation Java EE applications can be built as a Set of collaborating microservices on a lightweight runtime
INSERT DESIGNATOR, IF NEEDED14 Java EE Microservices with WildFly Swarm
INSERT DESIGNATOR, IF NEEDED Wildly Swarm 15 ● OSS Project sponsored by Red Hat ● Focused on Java EE Microservices ● Sidekick of WildFly Application Server ● Growing and active community
INSERT DESIGNATOR, IF NEEDED16 ● Use the APIs you want ● Include the capabilities you need ● Wrap it up for deployment Just Enough Application Server Product Pricing Service JAX-RS Web Front End JPA JMS EJB Bean ValidationETC...UNUSED WildFly Application Server
INSERT DESIGNATOR, IF NEEDED Converting Existing App to an Uberjar 17 ● swarmtool - Create an uberjar out of an existing .war file ● Or, add WildFly Swarm maven plugin to your pom.xml A very different kind of implementation <plugin> <groupId>org.wildfly.swarm</groupId> <artifactId>wildfly-swarm-plugin</artifactId> <version>${wildfly-swarm-version}</version> <executions> <execution> <id>package</id> </execution> </executions> </plugin>
INSERT DESIGNATOR, IF NEEDED18 Show some code
INSERT DESIGNATOR, IF NEEDED19 Creating a WildFly Swarm App from Scratch WildFly Swarm Generator
INSERT DESIGNATOR, IF NEEDED20 Creating a WildFly Swarm App from Scratch JBoss Forge
INSERT DESIGNATOR, IF NEEDED21 ● Provide a specific piece of functionality ○ May map to a WIldFly subsystem ○ Or non-WildFly functionality (Ribbon, Keycloak) ● Fractions can provide deployments ○ Topology deployment give access to the topology ● Fractions can alter user deployments ○ Keycloak fraction can be used to secure a deployment ● Can be auto-detected by Swarm plugin, or specifically enabled and configured Fractions Errr, kinda like a module
INSERT DESIGNATOR, IF NEEDED22 ● Not required ● Fractions provide reasonable defaults ● If you do not provide a Main(), a default Container is created ● If you provide a Main() ○ Then you can manually override defaults ○ And do more ■ Locate other services ■ Dynamically adapt components To Main() or not to Main()
INSERT DESIGNATOR, IF NEEDED23 Simple Java EE Monolith wildfly-swarm.io/tutorial
INSERT DESIGNATOR, IF NEEDED24 Show some code
Inversion of (Platform) Control
Java Microservices
Java Microservices (continued)
INSERT DESIGNATOR, IF NEEDED28 Wildfly-swarm.io github.com/wildfly-swarm ● Presentations ● Examples github.com/redhat-helloworld-msa/helloworld-msa github.com/javaee-samples/javaee7-samples
INSERT DESIGNATOR, IF NEEDED29 The End

Java EE Microservices

  • 1.
    Java EE Microservices withWIldFly Swarm John Clingan Senior Principle Product Manager
  • 2.
    INSERT DESIGNATOR, IFNEEDED2 ● 19 year OCJUG member ● Java developer since 1996 ● Ex-GlassFish and Ex-Java EE Product Manager (Sun & Oracle) ○ Java EE 6 - Java EE 8 (Planning) ● Product Manager @ Red Hat for next-gen platforms ● Java EE 7 Instructor at UC Irvine Extension Who Am I
  • 3.
    INSERT DESIGNATOR, IFNEEDED Microservices Defined 3 Pick a definition
  • 4.
    INSERT DESIGNATOR, IFNEEDED4 Microservices Defined Two Pizza teams
  • 5.
    INSERT DESIGNATOR, IFNEEDED5 “In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.” - Martin Fowler, ThoughtWorks Microservices Defined
  • 6.
    INSERT DESIGNATOR, IFNEEDED6 GOAL Agility / Velocity
  • 7.
    INSERT DESIGNATOR, IFNEEDED7 Pause - Switch to MicroProfile
  • 8.
    INSERT DESIGNATOR, IFNEEDED8 Are you Ready for Microservices?
  • 9.
    INSERT DESIGNATOR, IFNEEDED9 ● Basecamp ○ Millions of users ○ 200 controllers with 900 methods plus … ○ … 190 classes with 1473 methods ○ Happy with their approach The Majestic Monolith But first, a message from the “dark side” “Every time you extract a collaboration between objects to a collaboration between systems, you’re accepting a world of hurt with a myriad of liabilities and failure states.” Link: http://bit.ly/MajesticMonolith
  • 10.
    INSERT DESIGNATOR, IFNEEDED10 Java EE Microservices
  • 11.
    INSERT DESIGNATOR, IFNEEDED Java EE 7 APIs 11
  • 12.
    Traditional Java EEApplication Server Management
  • 13.
    INSERT DESIGNATOR, IFNEEDED Architecture vs API vs Implementation 13 Microservices is an architectural approach Java EE is a set of API specifications enabling the community to innovate on implementation Java EE applications can be built as a Set of collaborating microservices on a lightweight runtime
  • 14.
    INSERT DESIGNATOR, IFNEEDED14 Java EE Microservices with WildFly Swarm
  • 15.
    INSERT DESIGNATOR, IFNEEDED Wildly Swarm 15 ● OSS Project sponsored by Red Hat ● Focused on Java EE Microservices ● Sidekick of WildFly Application Server ● Growing and active community
  • 16.
    INSERT DESIGNATOR, IFNEEDED16 ● Use the APIs you want ● Include the capabilities you need ● Wrap it up for deployment Just Enough Application Server Product Pricing Service JAX-RS Web Front End JPA JMS EJB Bean ValidationETC...UNUSED WildFly Application Server
  • 17.
    INSERT DESIGNATOR, IFNEEDED Converting Existing App to an Uberjar 17 ● swarmtool - Create an uberjar out of an existing .war file ● Or, add WildFly Swarm maven plugin to your pom.xml A very different kind of implementation <plugin> <groupId>org.wildfly.swarm</groupId> <artifactId>wildfly-swarm-plugin</artifactId> <version>${wildfly-swarm-version}</version> <executions> <execution> <id>package</id> </execution> </executions> </plugin>
  • 18.
    INSERT DESIGNATOR, IFNEEDED18 Show some code
  • 19.
    INSERT DESIGNATOR, IFNEEDED19 Creating a WildFly Swarm App from Scratch WildFly Swarm Generator
  • 20.
    INSERT DESIGNATOR, IFNEEDED20 Creating a WildFly Swarm App from Scratch JBoss Forge
  • 21.
    INSERT DESIGNATOR, IFNEEDED21 ● Provide a specific piece of functionality ○ May map to a WIldFly subsystem ○ Or non-WildFly functionality (Ribbon, Keycloak) ● Fractions can provide deployments ○ Topology deployment give access to the topology ● Fractions can alter user deployments ○ Keycloak fraction can be used to secure a deployment ● Can be auto-detected by Swarm plugin, or specifically enabled and configured Fractions Errr, kinda like a module
  • 22.
    INSERT DESIGNATOR, IFNEEDED22 ● Not required ● Fractions provide reasonable defaults ● If you do not provide a Main(), a default Container is created ● If you provide a Main() ○ Then you can manually override defaults ○ And do more ■ Locate other services ■ Dynamically adapt components To Main() or not to Main()
  • 23.
    INSERT DESIGNATOR, IFNEEDED23 Simple Java EE Monolith wildfly-swarm.io/tutorial
  • 24.
    INSERT DESIGNATOR, IFNEEDED24 Show some code
  • 25.
  • 26.
  • 27.
  • 28.
    INSERT DESIGNATOR, IFNEEDED28 Wildfly-swarm.io github.com/wildfly-swarm ● Presentations ● Examples github.com/redhat-helloworld-msa/helloworld-msa github.com/javaee-samples/javaee7-samples
  • 29.
    INSERT DESIGNATOR, IFNEEDED29 The End