Learn from Java Champion David R. Heffelfinger: Get Your Head in the Cloud with Jakarta EE and MicroProfile

In our new Java Monthly edition, we’d like to introduce you to David R. Heffelfinger. He was kind enough to share his experience on 12 more Java-related questions. David Heffelfinger is an independent consultant based in the Washington, DC area. He is a Java Champion and Apache NetBeans PMC member, as well as a Java […]

by Dreamix Team

February 27, 2023

6 min read

Copy of Java Special Daily Johan Vos 19 - Learn from Java Champion David R. Heffelfinger: Get Your Head in the Cloud with Jakarta EE and MicroProfile

In our new Java Monthly edition, we’d like to introduce you to David R. Heffelfinger. He was kind enough to share his experience on 12 more Java-related questions.

David Heffelfinger is an independent consultant based in the Washington, DC area. He is a Java Champion and Apache NetBeans PMC member, as well as a Java instructor. David has written several books on Java EE and related technologies and is a frequent speaker at technology conferences. You can connect with David on LinkedIn at https://www.linkedin.com/in/dheffelfinger/ and follow him on Twitter https://twitter.com/ensode.

Dreamix: What are the main drivers for an application to be cloud-native?

David R. Heffelfinger: The Cloud Native Computing Foundation provides the following description for cloud native technologies: “Cloud native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and declarative APIs exemplify this approach.” 

In practice this means cloud native applications are developed as microservices, containerized (typically with Docker) and deployed to the cloud.

Dreamix: How does Jakarta EE respond to today’s needs for cloud architectures?

David R. Heffelfinger: Most Jakarta EE vendors provide lightweight runtimes suitable for containerization and microservices development, for example, Red Hat provides Wildfly Swarm and Quarkus, Payara provides Payara Micro, IBM provides Open Liberty, Oracle provides Helidon Tomitribe provides Apache TomEE, and so on and so forth.

Applications developed against the Jakarta EE specification can be deployed to these lightweight runtimes, then containerized and deployed to the cloud.

Additionally, Jakarta EE 10 introduced the core profile, which specifically targets small runtimes and does not include APIs typically not used in cloud applications.

Dreamix: Can you discuss the role of MicroProfile in cloud-native applications?

David R. Heffelfinger: Microprofile provides several APIs that simplify solving problems typically found in cloud environments.

For example: 

• MicroProfile metrics simplifies integration with Prometheus and other popular monitoring tools.

• MicroProfile provides a fault tolerance API we can use to mitigate the risk of a misbehaving microservice negatively affecting other microservices in the application.

• The MicroProfile Health Check API allows us to easily generate a health check endpoint that can be used by cloud providers to determine the health of the application. These tools then could potentially automatically restart misbehaving microservices without any additional effort on our part.

• MicroProfile OpenTracing provides distributed tracing that can be used to follow a trace of execution across multiple microservices.

Dreamix: How can MicroProfile be used to migrate a monolithic application to microservices?

David R. Heffelfinger: MicroProfile leverages the Jakarta EE RESTful Web Services API (formerly known as JAX-RS). Which makes it the path of least resistance when migrating legacy Java EE applications leveraging RESTful web services to microservices and the cloud.

Additionally, some MicroProfile APIs provide basic functionality “out of the box”, without us having to implement anything. For example, the Metrics API provides basic metrics with no effort on our part, and the Health Check API automatically provides a basic endpoint indicating if our application is up. The fact that MicroProfile provides functionality out of the box helps lower the effort required to leverage integration with cloud specific tools such as monitoring tools and service controllers.

Dreamix: What are the advantages of MicroProfile, compared to competitors like the Spring framework, when developing microservices?

David R. Heffelfinger: The main advantage of both MicroProfile and Jakarta EE over alternatives is that both MicroProfile and Jakarta EE are standards with multiple implementations. What this means is that code written against either standard can be deployed against several implementations. For example, a microservice developed using the MicroProfile APIs can be deployed to several runtimes such as IBM’s OpenLiberty, Red Hat’s Quarkus, Oracle’s Helidon, Apache Tomee or Payara Micro.

The fact that there are multiple implementations prevents vendor lock in, allowing us to easily migrate our applications to another vendor’s implementation.

Dreamix: How does Payara Micro support the deployment and management of applications in cloud environments?

David R. Heffelfinger: Payara Micro is a lightweight runtime supporting both Jakarta EE and MicroProfile, therefore it can be easily containerized and deployed to a cloud environment.

Payara Services Ltd, the company behind Payara Micro also provides their own cloud service, appropriately named Payara cloud, that automates much of the work needed to deploy an application to the cloud. When using Payara Cloud, all a developer needs to do to deploy to the cloud is upload a WAR file to Payara Cloud, no need to write a dockerfile, Kubernetes YAML files, etc, all of these tasks are automated by Payara Cloud. This allows us as application developers to focus on implementing business logic without having to worry about configuring infrastructure for our cloud applications.

Dreamix: How does Payara Server compare to other application servers, such as WildFly?

David R. Heffelfinger: Both Payara Server and WildFly are excellent Jakarta EE runtimes. They are both traditional, heavy weight runtimes typically used to develop monolithic applications. Although cloud deployments are very popular nowadays, there is nothing inherently wrong with traditional monolithic applications, either Payara Server or WildFly are excellent choices for this, as are other Jakarta EE runtimes such as JBoss, Websphere, or Weblogic. Which one to use really comes down to personal preference, or, in some cases, it depends on which vendor your employer has a support contract with.

Dreamix: Can you discuss the role of open-source in the Jakarta EE community, and how users can contribute to the development of the projects?

David R. Heffelfinger: Jakarta EE and MicroProfile are somewhat unique in that the specifications themselves are open source. There are countless open source libraries and applications, but as far as I know MicroProfile and Jakarta EE were the first open source specifications. With the specifications themselves being open source, anyone can contribute and help steer the direction of Jakarta EE.

As to how to contribute, there is a detailed guide at https://jakarta.ee/community/get-involved/.

Dreamix: What is some upcoming Jakarta EE improvement that you are excited about and why?

David R. Heffelfinger: Jakarta EE 10 was released fairly recently, it is not yet clear what new features will be included in the next version. One new feature that I really like about Jakarta EE 10 is the introduction of the core profile, which makes Jakarta EE even more suitable for microservices development than before.

Dreamix: What learning resources would you recommend to Jakarta EE and MicroProfile enthusiasts?

David R. Heffelfinger: Jakarta EE 9 and 9.1 introduce no new features, so any books on Java EE 8 should work to get familiar with these versions of the specification. My own book on Java EE 8 Application Development is perfectly feasible for learning Jakarta EE 9.x

For Jakarta EE 10, the upcoming book Pro Jakarta EE 10 by Peter Späth looks very promising.

Dreamix: How do you update yourself about the latest trends in Java?

David R. Heffelfinger: As a book author and instructor, I frequently find myself having to learn technologies before there is much documentation about them. I subscribe to mailing lists of projects that interest me, read specifications, and play around with beta and even alpha versions of Java related tools and libraries.

Dreamix: Can you recommend a favorite book about programming? What about a favorite book in general?

David R. Heffelfinger: Although more of a project management book than a programming book per-se, a very influential book is The Mythical Man-Month by Fred Brooks, the main topic of the book is that adding manpower to a software project that is behind schedule delays it even longer. I recommend this book not only to software developers, but to anyone managing a software development project, it is quite an eye opener.

As for a favorite book in general, The Now Habit by Neal Fiore is a great book on how to tackle procrastination, an issue we all struggle with to some extent.

Is there anything else you would like to ask David R. Heffelfinger? What is your opinion on the questions asked? Who would you like to see featured next? Let’s give back to the Java community together!

Innovators by heart. Developers by passion. We’re Dreamix Team - a group of trailblazing techies trying to make the world a better place through technology. We provide custom software development, keep you updated on market and industry trends, and have a great time doing it.