Try out the MicroProfile Configuration API and Fault Tolerance features for building Java microservices in the August/September 2017 beta of WebSphere Liberty.
Thanks to your support for our regular beta programme, we are able to release new Liberty features every few months. Most recently, in June. Look out for more betas over the coming months.
MicroProfile Configuration API feature
The MicroProfile Configuration specification provides a single way to view and access multiple sources of configuration, such as properties files and environment variables, including
bootstrap.properties, user-level properties files, registered Java classes that implement the ConfigSource API, and the Java
When your applications are deployed as microservices, having a single place to update the configuration data of multiple microservices is useful for several reasons. Building systems as collections of independent microservices increases the number of services that need to be managed. Different stages in the pipeline often use different configuration sources for a single piece of configuration data and a given component needs updating as it moves through the pipeline. Containerisation of services means that even while a component is ‘live’ in production, the environment it is running in might be more dynamic and the components need configuration updates without being restarted.
The Eclipse MicroProfile initiative exists for ‘Optimizing Enterprise Java for a microservices architecture’ and, after the initial base platform of existing services was defined, the Microprofile Configuration API was the first new API released by the MicroProfile community. The API allows for a consistent means to access configuration data from pluggable configuration sources. Configuration properties can be injected using Java CDI in a form that is easy to consume. Data values and sources can vary across the devOps pipeline without code change or repackaging, and dynamic and fully typed data is catered for.
Enabling the MicroProfile Configuration API feature
Just update your
<featureManager> <feature>mpConfig-1.0</feature> </featureManager>
For more information, see the Knowledge Center.
MicroProfile Fault Tolerance
The increasing size of ‘web-scale’ applications, newer architectures that are as likely to ‘scale out’ as to ‘scale up’, and the rising popularity of microservice architectures all contribute to the growing number of services that can be involved in a single business application. When combined with a utility model for service provision it is increasingly important to build fault tolerance into our system architecture.
Fault tolerance can be improved using a number of well tested approaches that handle failure:
- TimeOut: Limit the amount of time we are prepared to wait for a result
- RetryPolicy: Control how much we are prepared to re-submit a request
- Fallback: Specify what should we do when the primary service cannot be used successfully
- Bulkhead: If calls to a service are slow (perhaps it is overloaded or we are timing out), specify what proportion of our local resources we are prepared to get involved in the traffic jam
- CircuitBreaker: When a service is proving unreliable, for example timing out, we can choose to ‘fail fast’ by automatically failing calls to it under control
With the Microprofile Fault Tolerance specification, we can control all these aspects with easy-to-use Java annotations at a method or class level that is independent of any particular vendor or implementation library.
Enabling the MicroProfile Fault Tolerance feature
Just update your
<featureManager> <feature>mpFaultTolerance-1.0</feature> </featureManager>
Then take a look at these code snippets in the Knowledge Center to get started.
Whatâ€™s already in there?
The August Liberty beta included the OpenAPI v3 feature, plus updates to the MicroProfile Config and Fault Tolerance features.
Take a look at the previous beta announcements for a full list of stuff added since the 18.104.22.168 release in June 2017: