We recently published a series of guides on how to write reactive Java microservices. There are currently five reactive guides, four on writing the code and one on testing it in true-to-production environments. This brings our total number of Open Liberty guides to more than 50, which we are rather proud of in just three years, considering the amount of work and quality-checking that goes into each of them.
If you’d like to find out more about our new reactive guides, read on. If you’re not already familiar with the Open Liberty guides already, we’ll start with a brief introduction…
What are guides?
The Open Liberty guides are similar to tutorials but, instead of asking you to work through a set of step-by-step instructions with no explanation of the code you’re constructing, the guides take an aspect of a simple web services application and talk you through how you’d build it yourself, explaining how the code works as you go. You can complete a guide in just 15 mins or so.
Each guide has two copies of a simple application in its GitHub repository: a
finish version, which you can just run to see what it does, and a
start version, which has pieces of the application missing. As you work through the guide, you create the missing pieces of the
start version, which can include, for example, adding one or more Java classes, adding a server configuration, or updating a Maven configuration. All the code is provided for you so you can be confident that what you create will work at the end.
The guides assume no prior knowledge of a topic, and they take you from beginning to end (but if you’re intermediate, just use the Table of Contents to skip forward to a specific part). Prerequisites are also kept to a minimum. And if you don’t want to bother with any code on your local machine, take a look at our interactive guides which require only a browser:
When you’ve finished working through the guide as a tutorial, you can then take the code from the example application and continue learning by adapting or extending the code for your own purposes. Alternatively, if you’re just looking for code examples, you can just browse the guide’s GitHub repository for code similar to what you need and read how it works in the guide.
Learning with guides
We recently published a new series of guides about writing reactive microservices using MicroProfile Reactive Messaging. These reactive messaging guides take a similar approach to our existing guides and demonstrate how to write simple web services with a reactive architecture.
The first in the reactive series of guides looks at how to create reactive Java microservices. It takes a simple reactive messaging app and shows you how to build it:
The guide introduces the concepts that you need to understand to follow the guide. In this case, it gives a brief introduction to asynchronous messaging between microservices and how MicroProfile Reactive Messaging makes it easy to asynchronously send, receive, and process messages when they’re received as continuous streams of events.
The guide then takes you through each of the main classes for the services in the application and explains the key parts of how the code works. You can copy the code to the partial application in the GitHub repository’s
start directory to build the app as you read. The guide then shows you how to build, run, and test it.
After that, you can play with the code by yourself and adapt it for your own purposes or move on to another of the guides. Each guide focuses on a single aspect of writing reactive Java microservices.
The new reactive series contains the following guides:
Learning to write cloud-native Java microservices
The new reactive guides are just the latest of more than 50 developer guides that we’ve published on the Open Liberty website over the past three years. Many of the guides cover topics relating to how to develop cloud-native Java applications, in particular using Eclipse MicroProfile technologies, including:
Creating a RESTful web service using JAX-RS and JSON-B.
Consuming a RESTful web service using MicroProfile Rest Client.
Documenting RESTful APIs using MicroProfile OpenAPI.
Configuring microservices using MicroProfile Config.
Building fault-tolerant microservices with the @Fallback annotation using MicroProfile Fault Tolerance.
Providing metrics from a microservices using MicroProfile Metrics.
Securing microservices with JSON Web Tokens using MicroProfile JWT.
There is also a selection of interactive MicroProfile guides which are all browser-based and focus on explaining the concepts in an interactive way, including:
Separating configuration from code in microservices using MicroProfile Config.
Preventing repeated failed calls to microservices using MicroProfile Fault Tolerance’s Circuitbreaker and Fallback policies.
Beyond MicroProfile, there are guides on complementary technologies for writing cloud-native Java applications using established Jakarta EE technologies, including:
Securing a web application using Jakarta EE Security.
The guides cover the whole developer lifecycle including building an application with Maven or Gradle, testing the application, containerizing the application, and then deploying the application to one of several commercial cloud platforms, including IBM Cloud, Red Hat OpenShift, and Microsoft Azure.
Will there be more new guides?
Our guides have been really well-received so we’re not stopping at 50. We have a large backlog of proposed guides, some of which we’re already working on and are nearly ready to publish, on topics such as using the Open Liberty Operator, securing applications with OpenID Connect, and accessing data in MongoDB.
You’re welcome to propose new guides by raising an issue and writing an outline for consideration. Especially let us know if you can contribute in some way once the guide has been accepted, whether that’s by writing the guide, writing some code, or both.
If you see any errors in our existing guides, feel free to raise an issue against that guide’s GitHub repository (each guide has its own repository, which you can find in the guide text) or to create a PR to fix it.