Wednesday, 27 June 2018

Making Java objects queryable by Infinispan remote clients

The following is a common question amongst Infinispan community users:
How do I make my Java objects queryable by remote clients? 

Annotation Method


The simplest way is to take advantage Infinispan Protostream annotations to mark your objects queryable and decide how each object field should be indexed. Example:

Then, the ProtoSchemaBuilder can inspect the annotated class and derive a Google Protocol Buffers schema file from it. Example:

Finally, the schema file needs to be registered in the “___protobuf_metadata” cache:

Although this is by far the easiest way to make your Java objects queryable, this method might not always be viable. For example, you might not be able to modify the Java object classes to add the annotations. For such use cases, a more verbose method is available that does not require modifying the source code of the Java object.

Plain Object Method


For example, given this Java object:

A Protocol Buffers schema must be defined where comments are used to define the object as queryable and decide how each field is indexed:

This method also requires a Protostream message marshaller to be defined which specifies how each field is serialized/deserialized:

This method still requires the Protocol Buffers schema to be registered remotely, but on top of that, the schema and marshaller need to be registered in the client:

Clearly, this second method is a lot more verbose and more laborious when refactoring. If any changes are made to the Java object, the marshaller and Protocol Buffer schema need to also be changed accordingly. This is done automatically in the first method.

Both methods are demonstrated in full in the queryable-pojos demo.

Cheers
Galder

Tuesday, 26 June 2018

Infinispan 9.3.0.Final is out!

We're delighted to announce the release of Infinispan 9.3.0.Final, which is a culmination of several months of hard work by the entire Infinispan community. Here's a summary of what you can find within it:

  • First final release to work with both Java 8 and Java 10. Note that Infinispan only works in classpath mode.
  • Transaction support Hot Rod. The java Hot Rod client can participate in Java transactions via Synchronization or XA enlistment. Note that recovery isn't supported yet.
  • Caches can now configure the maximum number of attempts to start a CacheWriter/CacheLoader on startup before cache creation fails.
  • Write-behind stores are now fault-tolerant by default.
  • Segmented On Heap Data Container. It improves performance of stream operations.
  • Server upgraded to Wildfly 13.
  • We have introduced several WildFly feature packs to make it easier for Infinispan to be utilised on WildFly instances via the Server Provisioning Plugin. The following feature packs have been created, most notably:
    • infinispan-feature-pack-client
      • All of the modules required to connect to a hotrod server via the client
    • infinispan-feature-pack-embedded
      • The modules required for embedded instances of Infinispan
    • infinispan-feature-pack-embedded-query
      • The same as above but with query capabilities
    • infinispan-feature-pack-wf-modules
      • This is equivalent to the Wildfly-modules.zip
  • Hibernate second-level cache provider works with Hibernate ORM 5.3.
  • The Hot Rod Server allows now to use multiple protocols with a Single Port. The initial version supports HTTP/1.1, HTTP/2 and Hot Rod. Switching protocols can be done using TLS/ALPN and HTTP/1.1 Upgrade header.
  • Admin console - improved all editors (schema, scripts, JSON data) to include syntax highlighting.
  • Several enhancements in the Java Hot Rod client allowing to read and write data in different formats such as JSON, for cache operations and deployed filters/converters.
  • Cluster wide max idle expiration.
  • Component Upgrades
    • Hibernate Search 5.10
    • Hibernate ORM 5.3
  • Numerous bug fixes which improve stability
For more details, please check our issue tracking release notes.

Thanks to everyone involved in this release! Onward to Infinispan 9.4!

Cheers,
Galder

Tuesday, 5 June 2018

Thanks Great Indian Developer Summit & Voxxed Days Zurich

A few days after Devoxx France, I headed for Great Indian Developer Summit in Bangalore where I spoke about handling streaming data on top of a Kubernetes platform. This was a very similar talk to the one I gave at JFokus but with some important changes. Together with Clement we created a small RxJava 2 façade for Infinispan. When combined with Vert.x RxJava 2 API, we could finally have an idiomatic way of handling streaming data asynchronously and coordinating events purely using RxJava 2 APIs. This is crucial for working with streaming data in an efficient way. On top of that, I made some changes to push the binary data used by the demo outside of the deployment.

Unfortunately Murphy struck during the presentation and I was unable to run the live coding demo. A problem with Docker size image during preparation combined with a cleanup I ran before the talk meant some of the images had to be re-downloaded. The wireless internet connection at the conference nor the mobile connection were good enough for me to recover it. Once back in the hotel where I had a stable connection I was able to record a screencast of the steps I would have followed during the Great Indian Developer Summit talk. You can find this screencast below:



The code from the demo can be found here. The live coding steps I followed are defined here. Finally the slides can be found here:

Finally, for something slightly different, back in March I joined Ray Tsang for a talk at Voxxed Days Zurich. This was a really fun talk to be part of! We combined past stories of my time at JBoss support with Ray's Kubernetes troubleshooting experience to create an engaging talk :). You can find the video below:



The week after Sebastian Łaskawiec and I travelled to Red Hat Summit as part of the work we did to integrate Red Hat Data Grid (Infinispan product version) into the Scavenger Hunt game presented on the keynote of the last day. Both Sebastian and I have been working on a blog series which will be published very soon.

Cheers,
Galder

Monday, 4 June 2018

Infinispan 9.3.0.CR1

Dear Infinispan Community,

we're glad to announce that 9.3.0.CR1 is out!

This is the first release which works with both Java 8 and Java 10. Pre-releases of Java 11 work too. Note that Infinispan still only works in classpath mode.

Highlights of this release include:
  • Expanded transaction support in Hot Rod, which can now participate in Java transactions via Sync or Xa enlistment. Transaction recovery isn't supported yet.
  • Caches can now configure the maximum number of attempts to start a CacheWriter/CacheLoader on startup before cache creation fails.
  • Write-behind stores are now fault-tolerant by default
  • Segmented On-Heap Data Container improves stream operation performance
  • We have introduced several WildFly feature packs to make it easier for Infinispan to be utilised on WildFly instances via the Server Provisioning Plugin. The following feature packs have been created:
    • infinispan-feature-pack-client: all of the modules required to connect to a hotrod server via the client
    • infinispan-feature-pack-embedded: the modules required for embedded instances of Infinispan
    • infinispan-feature-pack-embedded-query: the same as above but with query capabilities
    • infinispan-feature-pack-wf-modules: this is equivalent to the wildfly-modules.zip
  • 2-Level cache now works with Hibernate ORM 5.3
  • The server now allows multiple protocols with a Single Port. The initial version supports HTTP/1.1, HTTP/2 and Hot Rod. Switching protocols can be done using TLS/ALPN and HTTP/1.1 Upgrade header.
  • Admin console - improved all editors (schema, scripts, JSON data) to include syntax highlighting
  • Component Upgrades: Hibernate Search 5.10 and Hibernate ORM 5.3
Numerous bug fixes which improve stability are also included (here is the full list of the solved issues).

As usual, you can find all the bits on our website. If you find any issues, don't hesitate to report them on our issue tracker.