What's New With REST in Open Liberty?
This post focuses on improvements made the open source microservices backed by the Open Liberty project, but there're some globally applicable lessons too.
Join the DZone community and get the full member experience.Join For Free
It’s been a few months since you heard from us, so we wanted to check in and let you know about a few things we’ve been working on and a preview of what we’ve got in the 220.127.116.11 release of Open Liberty.
First, let’s take a look back at what we did earlier in 2018. Over the summer, we shipped JAX-RS 2.1 in Open Liberty 18.104.22.168. This adds powerful new features like the Reactive Client, Server Sent Events, and more. If you missed it, check out our 22.214.171.124 blog post.
In September, we delivered the MicroProfile Rest Client 1.1 in Liberty 126.96.36.199. This adds asynchronous methods, URI support, better integration with CDI and a RestClientBuilderListener for third-party libraries to integrate with client instances.
While our upcoming 188.8.131.52 release won’t have any blockbuster spec implementations, we have still been hard at work. Here are some of the things we’ve been working on.
New Async Transport Layer
We integrated the Apache HTTP Client transport layer from the CXF project. This improves asynchronous method invocations — in some performance benchmarks, we measured a 20-25% improvement in throughput (your mileage may vary).
Connection Pooling Enhancements
The JAX-RS client has had HTTP connection pooling for a while, but HTTPS connections were not being pooled. As more and more services require HTTPS (this is a good thing!), it can be a burden for systems to construct, tear down, and reconstruct connections to the same endpoint. Starting with Liberty 184.108.40.206, HTTPS connections are now pooled.
JAX-RS 2.1 introduced the reactive client, but the spec only requires vendors to implement it using Java 8’s
CompletionStage API. Other reactive frameworks can integrate with the reactive client, but that is optional in the spec. With Liberty 220.127.116.11, it is now possible to use these extensions. We’ve tested with RxJava 1 and 2 using providers from Apache CXF and Jersey, and we plan to test more. If there is a particular reactive technology that you would like to use, and it has a JAX-RS
RxInvokerProvider implementation, please let us know!
Properties Handling in the MicroProfile Rest Client
RestClientBuilder and MicroProfile Config allows users to specify custom properties to the Rest Client instance. Now, you can use JAX-RS Client properties, such as:
com.ibm.ws.jaxrs.client.keepalive.connection- which you can set to
closeto prevent keeping connections alive for multiple requests.
com.ibm.ws.jaxrs.client.connection.timeout- milliseconds to wait for the HTTP connection to be established before timing out.
com.ibm.ws.jaxrs.client.receive.timeout- milliseconds to wait for a response from the remote service once the connection has been established.
com.ibm.ws.jaxrs.client.proxy.host- hostname of the proxy server to use for requests from this client instance.
com.ibm.ws.jaxrs.client.proxy.port- port number of the proxy server to use for requests from this client instance.
Other Bug Fixes and Minor Enhancements
We’re constantly trying to improve the JAX-RS and MicroProfile Rest Client implementation. Sometimes we find things to fix on our own, and sometimes our users help us find bugs to fix. If you discover a bug or can think of something that we can do in Open Liberty to make it better, please let us know! The best way is probably to open an issue in GitHub, but you can also talk with us on the Open Liberty mailing list.
Thanks for checking in with us; we hope you enjoy the release!
Published at DZone with permission of Andy McCright, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.