What are microprofile.io and MicroProfile?
microprofile.io is a community created in 2016 dedicated to rapid innovation around Microservices and Enterprise Java, supported by many people from the Java EE community including a number of Java User Groups and Enterprise Java vendors IBM, Red Hat, Tomitribe, and Payara. This community is actively working together on building and integrating the technologies best-suited to modern Java cloud-native applications that follow microservices architectural patterns. IBM and the other collaborators believe that a multi-provider approach is in the best interests of the wider community to ensure greatest freedom of choice in the future, as well as an architectural approach that is flexible enough to run efficiently across a broad set of Java technology stacks.
The intention of the microprofile.io community is to involve a broad set of collaborators to identify, implement, refine, and improve technologies that are commonly used in lightweight microservices and to demonstrate their use across a variety of popularity runtime environments. These technologies will evolve and mature at different rates but will do so having demonstrated their ability to integrate into a number of Java environments. The community expects to use its experience of successful projects to inform the future direction of Java EE through JSR submissions, and believes this will be the most efficient way to evolve Java EE in the future.
Within the microprofile.io community the term MicroProfile is used to describe the set of technologies that we are working on. At various points in the evolution of MicroProfile we define a specific set of technologies to represent a concrete MicroProfile version. As an example, MicroProfile 1.0 was defined by the community and announced in October 2016 at JavaOne. This was a simple baseline of the set of technologies from Java EE 7 that are most commonly used in microservice applications. The next version of MicroProfile will include some capabilities beyond Java EE 7 that we expect to become part of the Java EE platform in the future.
The early success of the collaboration quickly outgrew our capacity to manage it informally and, in November 2016, the community submitted a new MicroProfile project proposal to the Eclipse Foundation to take advantage of the collaborative infrastructure provided by the foundation. This is where we expect ongoing work in the community to occur.
MicroProfile applications on Liberty
Liberty is a particularly good environment for MicroProfile applications because of its lightweight and composable nature. Liberty capabilities are defined in terms of runtime features which are configured for each runtime instance to provide choice with consistency. For example, a server offering all the capabilities of MicroProfile 1.0 can be started with the following configuration:
<server description="new server"> <featureManager> <feature>microProfile-1.0</feature> </featureManager> </server>
Where Liberty really comes into its own is when you want to create a server with closely-tailored capabilities. For example, MicroProfile 1.0 does not, itself, include the WebSockets capability of Java EE but if you wanted to create a MicroProfile application that used WebSockets then you simply add the
websocket-1.1 feature to this Liberty server definition:
<server description="new server"> <featureManager> <feature>microProfile-1.0</feature> <feature>websocket-1.1</feature> </featureManager> </server>
In fact, if you started with a server running with the original configuration, you could add the
websocket-1.1 feature, save the configuration and see the WebSockets feature get dynamically added to the running server instance—which is a particular bonus in a development environment when you want to minimize server restarts whilst developing an application.
Getting started with Liberty and MicroProfile
The options to get started with Liberty and MicroProfile are shown on our Getting Started page. For example, you can download a Liberty ZIP archive or Docker image or get your Maven build to pull it down as a dependency. All very easy. Then create a new server instance with a simple
server.xml like the ones shown above.
Another method is to use the Liberty Application Accelerator and choose the MicroProfile technology type:
This downloads Liberty, creates a server definition that includes the
websocket-1.1 features and a simple application, and sets up a Maven project to build and run the application.
Running the MicroProfile.io sample
The members of microprofile.io have created a number of samples that are intended to build up and demonstrate each feature in MicroProfile as it matures. The showcase sample is the Conference App which consists of a number of microservices and a web app managing a conference. When you build this sample, by default and by design, each microservice is packaged with a different vendor runtime: the Voting service is packaged on Liberty, the Schedule service on Payara, the Session service on Wildfly, the Speaker service on TomEE. This is intentional, to demonstrate multi-vendor support. Of course all services can be run on a single vendor stack too and the sample documentation describes how to run them all on Liberty.
If youâ€™re considering how best to create new Java microservices then go to the Liberty Getting Started page and pick the method that best suits you to add the Liberty runtime to your developer environment. This gives you an application runtime which, through simple configuration, you can strip down to
microProfile-1.0 or use all the capabilities of Java EE 7, or anything in between. And do keep an eye on the activities of the new Eclipse MicroProfile project to get the earliest glimpses of where we think enterprise Java is going for cloud native applications.
The MicroProfile Rest Client builds on JAX-RS 2.0 client APIs to provide a type-safe approach for invoking RESTful services. This means writing client applications with more model-centric code and less 'plumbing'. Although these are client APIs, they are deployed in a server. Here's how to create your own...
Alasdair introduces MicroProfile by explaining how to write a simple application based around the mundane but real-life requirement to book meetings.
Alasdair is on main stage at DevNation to launch a new open standard for micro-services using Enterprise Java called MicroProfile.