Chapter 1. What is Immutant?
Immutant is essentially an enhanced version of the JBoss Application Server 7. It repackages AS7 with additional modules that support Clojure applications, similar to what the TorqueBox project does for Ruby applications.
Immutant reduces the incidental complexity (a.k.a. accidental) inherent in non-trivial applications by providing an integrated platform for web, messaging, scheduling, caching, daemons, transactions, and more. This frees the developer from having to build a unique stack from scratch, not to mention the responsibility of supporting the evolution of that stack as the application requirements expand.
The Immutant API's are comprised of functions whose side effects trigger the services provided by the app server. For example:
;;; Mount a Ring handler, i.e. a web app (immutant.web/start "/" your.web/app) ;;; Start a message queue (immutant.messaging/start "/queue/tweets") ;;; Map a listener to the queue (immutant.messaging/listen "/queue/tweets" your.msg/handler) ;;; Schedule a recurring job to run at midnight (immutant.jobs/schedule "housekeeper" your.job/purge "0 0 0 * * ?") ;;; Create a distributed data grid (def data-grid (immutant.cache/create "tweets" :mode :distributed))
All of the above functions are dynamic, meaning you can call them from anywhere within your application. There are no XML or YAML config files, only Clojure.
Leiningen applications may be deployed directly from disk using a convenient Immutant plugin, so there is no need to package your app into a war file in order to deploy it.
Multiple applications can be deployed to the same Immutant instance and are each given a fully isolated Clojure runtime that allows the application to load its own versions of its dependencies (including Clojure itself) without affecting other applications.
Further, Immutant enables interactive, REPL-based development, allowing you to manipulate your application while it's running in the app server.