This document discusses Java EE microservices using WildFly Swarm. It begins with an introduction of the speaker and their background. It then defines microservices and discusses if you are ready to adopt this architecture. It introduces WildFly Swarm as an open source project for building Java EE microservices and how it provides just enough of an application server. It covers converting existing applications and creating new ones using WildFly Swarm and discusses fractions and the main method. Code examples and additional resources are provided.
2. 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
5. 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
9. 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
13. 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
15. 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
16. 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
17. 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>
19. INSERT DESIGNATOR, IF NEEDED19
Creating a WildFly Swarm App from Scratch
WildFly Swarm Generator
20. INSERT DESIGNATOR, IF NEEDED20
Creating a WildFly Swarm App from Scratch
JBoss Forge
21. 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
22. 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()