back to all blogsSee all blog posts

What's new with REST in Open Liberty in 2018?

image of author
Andy McCright on Dec 5, 2018
Post available in languages:

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 release of Open Liberty.

First, let’s take a look back at what we’ve done earlier this year. Over the summer, we shipped JAX-RS 2.1 in Open Liberty This adds powerful new features like the Reactive Client, Server Sent Events, and more. If you missed it, check out our blog post.

In September, we delivered the MicroProfile Rest Client 1.1 in Liberty 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 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, HTTPS connections are now pooled.

Reactive extensions

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, 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

The 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:

  • - which you can set to close to prevent keeping connections alive for multiple requests

  • - milliseconds to wait for the HTTP connection to be established before timing out

  • - milliseconds to wait for a response from the remote service once the connection has been established

  • - hostname of the proxy server to use for requests from this client instance

  • - 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 our release!