IBM’s latest monthly release of Open Liberty 19.0.0.4 features support for the MicroProfile Reactive Streams Operators 1.0 API, JDK 12, and Oracle Universal Connection Pool.
First introduced in September 2017, Open Liberty is an open source implementation of IBM’s WebSphere Liberty application server that provides a server runtime to build cloud native applications and microservices. It supports the full MicroProfile framework and Java EE APIs. Developers can use the getting started guides that provide examples on how to build, package and deploy web applications and microservices.
MicroProfile Reactive Streams Operators 1.0 Support
Reactive Streams provide a means for asynchronous stream processing with non-blocking back pressure that provides flow control and error handling. This enables a publisher to produce a potentially unbounded stream of data without overwhelming the consumer.
The subscriber requests an amount of data that it wishes to recieve and can control the flow and process the data stream at its own pace. MicroProfile Reactive Streams Operators offers a series of builders for creating instances of Reactive Streams Publisher, Subscriber and Processor.
In addition, operators such as filtering and mapping are provided to manipulate and transform the data stream. To enable MicroProfile Reactive Streams Operators 1.0 in Open Liberty 19.0.0.4, update the server.xml
file:
<featureManager>
<feature>mpReactiveStreams-1.0</feature>
</featureManager>
Once enabled, the Reactive Streams Operators API may be used to produce and consume data streams. Consider the following example where the publisher streams orders and the subscriber consumes the stream to fulfill the orders:
import org.eclipse.microprofile.reactive.streams.operators.CompletionRunner;
import org.eclipse.microprofile.reactive.streams.operators.PublisherBuilder;
import org.eclipse.microprofile.reactive.streams.operators.ReactiveStreams;
import org.eclipse.microprofile.reactive.streams.operators.SubscriberBuilder;
PublisherBuilder<Order> orderPublisher = ReactiveStreams.of(order1, order2);
SubscriberBuilder<Order, List<Shipment>> fulfillmentSubscriber =
ReactiveStreams.<Order>builder()
.map(order -> new Fulfillment(order).packAndShip())
.toList();
CompletionRunner<List<Shipment>> result = orderPublisher.to(fulfillmentSubscriber);
JDK 12 Support
Open Liberty 19.0.0.4 supports the recent release of JDK 12 featuring the new Shenandoah garbage collector and switch
expression syntax. Improvements to the existing G1 garbage collector via proposals JEP 344 and JEP 346 are also included in JDK 12. Note that, as a feature release, standard support for JDK 12 ends in September 2019.
Oracle Universal Connection Pool (UCP) Support
Oracle Universal Connection Pool (UCP) provides a JDBC connection pool for caching database connection objects. This allows users of Oracle Real Application Clusters (RAC) to leverage Oracle’s high availability and performance centric functionality such as Fast Connection Failover (FCF), Fast Application Notification (FAN), and Oracle Notification Services (ONS).
Open Liberty 19.0.0.4 supports UCP and can be enabled by updating the server.xml file to configure feature manager, datasource and the UCP driver path:
<featureManager>
<feature>jdbc-4.2</feature>
<feature>jndi-1.0</feature> <!-- Required only if JNDI is desired to look up resources -->
</featureManager>
<dataSource id="oracleUCPDS" jndiName="jdbc/oracleUCPDS" >
<jdbcDriver libraryRef="OracleUCPLib" />
<properties.oracle.ucp URL="jdbc:oracle:thin:@//{host}:{port}/{db}" />
</dataSource>
<library id="OracleUCPLib">
<fileset dir="{path_to_driver}" includes="ojdbcx.jar ucp.jar"/>
</library>
Use of UCP connection pool will disable Open Liberty’s built-in connection pooling functionality. As a result, some of the datasource and connection manager configuration values are ignored.
Earlier this year, InfoQ reported on the new four-week release cadence of Open Liberty and interviewed Kevin Sutter, MicroProfile and Jakarta EE architect for WebSphere at IBM.