Say we want some of the Java EE tools, but not all, in a combination that creates a platform optimised for a microservice architecture. Say we want it to be vendor-neutral. Introducing MicroProfile 1.0. In the three short months since MicroProfile was announced, version 1.0 has been released.
The need for MicroProfile
Yesterday we discussed the problem of applications outpacing the development of Java EE stacks. MicroProfile is prime example of organisations reacting to the slowing pace of Java EE releases. There is a fundamental shift in computing that is overtaking the release schedules in place. A collaboration between Red Hat, IBM, Tomitribe, Payara, the London Java Community and more, MicroProfile is a baseline platform definition that optimises Java EE for a microservices architecture. It delivers application portability across multiple MicroProfile runtimes.
As the name suggests, MicroProfile is lightweight. In the Tomitribe blog, Founder David Blevins explains: “If you look at all the servers in the Enterprise Java space, particularly Java EE implementations, you see a trend: lighter is better.”
Evolving from Java EE 6 Web Profiles, MicroProfile introduces a standard that vendors have to meet. So when building a microservices application, compatible containers can be swapped in and out without serious modification. The planned baseline is JAX-RS, CDI and JSON-P.
There are 6 implementations: Red Hat’s WildFly Swarm, IBM’s Liberty Profile, Tomitribe’s Apache TomEE, Payara’s Payara Micro, and Hammock. To see the standard in action, you can clone sample code and run it on any of the implementations.
In the wild…
Quick glance: WildFly Swarm
WildFly Swarm packages and runs Java EE applications with ‘just enough run time’. You can generate a project and customise to MicroProfile using the Project Generator, typing ‘MicroProfile’ in the dependencies box. You then get a zip containing a
pom.xml and basic JAX-RS resource. Setup is well documented here.
Quick glance: WebSphere Liberty
WebSphere Liberty is IBM’s implementation, that combines IBM technology and open source software. It boasts startup times under 2 seconds, no server restarts to pick up changes and simple XML configuration.
For those lucky enough to be at JavaOne, there is a session on Liberty’s support of MicroProfile and Java EE tomorrow.
Quick glance: TomEE
MicroProfile fits well with the “less is more” philosophy of Apache TomEE. TomEE is Tomcat with Java EE features. It is assembled from a vanilla Apache Tomcat zip file. Jars can be added and it is zipped up from there to create a MicroProfile environment.
Quick glance: Payara Micro
Payara Micro is lightweight at less than 70MB. It is designed for running Java EE applications in a modern containerised way. A cut-down version of Payara Micro 163.1, Payara MicroProfile was released this week. It is available on Maven Central.
It contains the MicroProfile APIs. It also includes Payara Micro favourites such as Uber Jar creation and JCache/Hazelcast as a core service.
Quick glance: Hammock
Hammock is a framework for bootstrapping CDI, launching a web server and deploying REST APIs. It is made available through Maven Central and can be added to a project as a dependency. There is a specific MicroProfile distribution which gives a basic application structure including the requisite dependencies to run Hammock. These include a Servlet Container (Undertow), a JAX-RS runtime (Apache CXF), a JSON-B library (Apache Johnzon) and a CDI runtime (Weld).
From there it is relatively simple to start a running container, and from there building REST endpoints. There are helpful Hammock-specific MicroProfile samples to get started with.
MicroProfile is reacting quickly to industry needs. It is lightweight and several implementations are easily containerised in Docker. Although the focus is on Java EE, according to Red Hat we can expect non Java EE frameworks and libraries in the future. Plus, you can easily switch between vendors as and when the need arises.
A core MicroProfile philosophy is to continuously gather feedback from the community. There is a simple survey at the bottom of the MicroProfile homepage. MicroProfile aims to ‘act as an open forum to optimise Enterprise Java for microservices architecture’, and one way it improves is by gathering this feedback.
MicroProfile aim to release version 1.1 and 1.2 in 2017. They have a feature backlog to prioritise including the likes of Bean Validation, JSON-B, OAuth2/Open ID Connect and more.
There is a luncheon at JavaOne on Thursday to hear more about MicroProfile 1.0 and its roadmap.
Debating Java EE, again
MicroProfile leverages work done in the Java EE space, so it is expected that participators will contribute to both Java EE and MicroProfile. It isn’t a move away from Java EE, but builds on it.
According to IBM STSM, Java EE and MicroProfile architect Kevin Sutter: “…hopefully, the results of the MicroProfile efforts will eventually be incorporated into future Java EE efforts. That’s what makes Liberty such a nice fit for supporting MicroProfile 1.0.”