A SWIG based framework to build Hotrod client prototype in your preferred language
If your are working on a non Java/C++/C#/JS application and you need to interact with Infinispan via Hotrod you may be interested in the idea behind the HotSwig project.
Hotswig proposes a framework to build Hotrod client prototypes quickly and for a generic SWIG supported language. As people familiar with C++ and C# Infinispan native clients know, SWIG plays a role in both the projects:
is used to build the base of the C# client wrapping the C++ core with a C# layer;
is used in the C project to run (part of) the Java test suite against the client, in this way: a Java wrapper is built via SWIG to make the C client looks like its Java big brother so it can be tested with the Java test suite.
The main goal was to produce for a specific language an almost complete client reusing the C++ core features and the following workflow has been setup to do that:
the whole C interface is processed by SWIG. The resulting wrapper exposes almost all the C functions;
a user friendly adaptation layer is build on top of the SWIG result.
This approach doesn’t work for the HotSwig goal, mainly because the effort need by the second step is usually not-negligible and prevents the rapid development of prototype in a generic language.
In the HotSwig approach, this limitation is removed moving the adaptation layer from the target language to the C++ side and then letting SWIG generate a ready to use client prototype. So the HotSwig workflow is the following:
build an adaptation facade around the C core to make it SWIG friendly (do the adaptation work once for all on the C side);
explicitly define what we want in the produced SWIG wrapper (keep things simple excluding everything by default);
run SWIG to produce the client.
At the moment HotSwig is just a proof of concept, but you can try to run it and produce a ready to work Infinispan client for the language you need. Examples are already provided for python, ruby and Octave, but HotSwig should work with all the SWIG supported languages. If you get it to run in your preferred programming language, please share your experience with us.
I’ve listed here some tasks for the roadmap, with the idea to test the flexibility of the framework trying to extend it in different directions. Maybe the idea is good and it can grow up from a PoC to something that can really help devs. You can add you ideas of course.
So if you need to do math against your Infinispan data set why don’t you try the Octave client? Or maybe you want to do analytics with R, or presentation with PHP. Or you just like parenthesis and you want to use Lisp. Or you’re working for the Klingon empire and you must use ylDoghQo'… well ok just joking now…
Thanks for reading!
Cheers The Infinispan Team
Get it, Use it, Ask us!We’re hard at work on new features, improvements and fixes, so watch this space for more announcements!
Please, download and test the latest release.
If you have questions, are experiencing a bug or want advice on using Infinispan, you can use StackOverflow. We will do our best to answer you as soon as we can.