Java EE Microservices
Transcript of Java EE Microservices
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 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 NEEDED9
● Basecamp○ Millions of users○ 200 controllers with 900 methods plus …○ … 190 classes with 1473 methods○ Happy with their approach
The Majestic MonolithBut 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 NEEDED
Architecture vs API vs Implementation
13
Microservices is an architectural approach
Java EE is a set of API specificationsenabling the community to
innovate on implementation
Java EE applications can be built as aSet of collaborating microservices
on a lightweight runtime
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 PricingService
JAX-RS
Web Front End
JPA
JMS EJB
BeanValidationETC...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 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
FractionsErrr, 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 NEEDED28
Wildfly-swarm.io
github.com/wildfly-swarm● Presentations● Examples
github.com/redhat-helloworld-msa/helloworld-msagithub.com/javaee-samples/javaee7-samples