The Deuce - Plans for Immutant 2

We haven't blogged about anything in a few months because we've been thinking about how we'd like to improve Immutant. We've come up with a couple of high-level goals:

  • Fully-functional libraries; no container required
  • Applications using those libraries should be optionally deployable to a stock WildFly or EAP container

One goal we don't have is API compatibility with Immutant 1.x.

Just Libraries

For its second major release, Immutant will simply be a collection of libraries, one for each of the commodity services currently available to applications using an Immutant 1.x container: web, scheduling, messaging, caching, and transactions. These services will be provided by the following underlying components: Undertow, Quartz, HornetQ, Infinispan, and Narayana, respectively. All but Quartz are the same as those used in WildFly 8.

So when you embed any Immutant 2.x library in your app, it will not require a "container" to be fully-functional. There is no required "installation" step. There is no required "deployment" step.

Just libraries.

Just WildFly/EAP

Fully-functional libraries are great, but there are still good reasons to deploy an app to a container, e.g. security, monitoring, clustering, etc. We want developers to be able to run the exact same application either outside or inside an app server. When outside, all functions in the Immutant namespaces will work as expected. But inside, you get more, automatically, without any changes to your code:

  • Web session replication
  • Load-balanced message distribution
  • Highly-available "singleton" scheduled jobs
  • Flexible Infinispan cache replication
  • Multiple polyglot app deployments

Immutant 1.x consists of modules and subsystems repackaged on top of a now-quite-old, forked AS7 distribution. AS7 is no longer under active development. All of the innovation is occurring in WildFly, and it became increasingly difficult to cherry-pick relevant changes into our fork.

So we're going to eliminate that headache in 2.x. Immutant applications will be deployable into stock, vanilla WildFly/EAP servers. No modules or subsystems or special deployment descriptors required. Just a jar file with a little code to setup the classpath and engage the container's services.

This means no more using Leiningen to resolve dependencies at deployment, which has been a source of bugs from the more adventurous project.clj files.

This also obviates overlay, another source of bugs. TorqueBox 4.x apps will work like Immutant 2.x, simple jar files deployed to stock WildFly/EAP installations, achieving the same features available from overlay today, without the brittle complexity.

Same Features, Less Hassle

Development is occurring on our thedeuce branch right now, but we'll merge it to master once we cut a 1.1.1 release. And we're publishing incremental releases here. We'll include more detailed instructions on how to try them in a future post. We currently have basic ring and scheduling support implemented, with both working standalone and inside a WildFly container. We hope to cut our first 2.x release this summer.

Immutant was inspired by its sister project, TorqueBox, under active development for almost 6 years now. Embracing Clojure's REPL, we strove to make Immutant's libraries more dynamic than TorqueBox. This caused the API's in each project to diverge somewhat, even though we have a number of community members who use both together via messaging, caching, etc.

So Immutant 2.x and TorqueBox 4.x represent an opportunity for both teams to work together to realign and harden the service API's, with an eye toward supporting other languages and implementations in the future. Please join us in either #torquebox or #immutant on freenode, to express your opinions and desires.

Overlay Screencast

I put together a quick screencast showing how to overlay the latest incremental releases of both Immutant and TorqueBox into a single app server capable of deploying both Clojure and Ruby apps.

Further, I show how those Clojure and Ruby apps can seamlessly exchange messages and share caches using the respective messaging and caching libraries from both Immutant and TorqueBox.


Hey, you got your Ruby in my Clojure!

UPDATE: This article is obsolete. See the Overlay Tutorial for current documentation and examples.

Recently, we've made some progress toward the promise of a polyglot application server. With the introduction of the Overlay project, it's now very easy to create a single app server capable of deploying both Ruby and Clojure (not to mention Java, of course) applications.

Laying TorqueBox over Immutant

The same Leiningen Immutant plugin that you use to install Immutant may be used to overlay the latest TorqueBox as well:

$ lein immutant overlay torquebox

And voila, your Immutant is suddenly also a TorqueBox! Now we need to set up your environment for TorqueBox development.

$ export TORQUEBOX_HOME=$HOME/.lein/immutant/current
$ export PATH=$TORQUEBOX_HOME/jruby/bin:$PATH

The TorqueBox distribution provides its own JRuby with the TorqueBox gems pre-installed. You can now use the torquebox command to deploy your Ruby applications to your Immutant!

Laying Immutant over TorqueBox

If you'd rather use your own JRuby, and you've already installed the torquebox-server gem, you can overlay the latest Immutant by cloning the Overlay project locally, installing Leiningen and running the following:

$ lein run :overlay $(torquebox env TORQUEBOX_HOME) immutant

All that's left is to set IMMUTANT_HOME and proceed as you normally would:

$ export IMMUTANT_HOME=$(torquebox env TORQUEBOX_HOME)

The Overlay project is capable of overlaying features from any JBoss AS7 distribution onto another one.

Convenient Combo-Pack

For your convenience, we've set up a job on our CI server to overlay the latest Immutant build atop the latest TorqueBox build whenever either is updated. So you can be on the bleeding edge of both projects by downloading and extracting this link:

Set both TORQUEBOX_HOME and IMMUTANT_HOME to the extracted directory, and...

Get Your Polyglot On!

Your overlaid server may be started however you're comfortable: either using the Leiningen Immutant plugin, the TorqueBox command or even the standard JBoss commands. It will start up all the apps you've deployed to it, regardless of their language.

If you have any trouble at all, please drop by #torquebox or #immutant on freenode, and we'll get you going.

Slides From My DevIgnition Polyglot AS Presentation

This past Friday I had the pleasure of presenting "The Polyglot Future of JBoss AS" to an audience of mostly Java developers at DevIgnition in NoVA.

Thanks to Gray Herter for organizing a great conference, and to Booz Allen Hamilton for sharing their kick-butt conference center.

If you are interested in the code for the demo, that's here.

The talk was recorded, so once that recording is available I'll update this post to point to it.

Here are my slides from that presentation for the enjoyment of all: