I am pleased to announce the release of the Okku library.
Okku is a Clojure wrapper around the Akka library. Very briefly, Akka brings the Actor model to the Scala programming language, and hence to the JVM. The Actor model is a model of computation based on small, asynchronous units that communicate only through message passing, without any shared memory.
This means an application built on the Actor model is trivial to distribute: actors do not know nor care whether the actors they communicate with are on the same machine.
It is of course no silver bullet: the whole application has to be designed specifically for the Actor model, so there is some upfront cost, and even though the code for an actor will be the same whether it communicates with local or remote actors, you still have to think about distribution while designing your system: problems such as network latency, lossy communications or node failings do not magically disappear.
Let’s get back to Okku: Okku brings Akka to the Clojure world, allowing one to create actors as easily as:
(use 'okku.core) (let [system (actor-system "test") echo-actor (spawn (actor (onReceive [msg] (println msg))) :in system)] (.tell echo-actor "Hello, world!"))
I have developed Okku for an application I am currently building. It is a distributed monitoring system based on the recognition of time-related event patterns, where I have to keep every partially recognized pattern for completeness reasons. Without going into more detail, it is pretty easy to see that each partially recognized pattern can be modeled as an actor waiting for more events to decide whether it shall be recognized or not.
The mapping from my problem domain to the Actor model thus seems pretty straightforward, and as I did not find any existing Actor library for Clojure, I wrote one. Once I had written it for my own use, I decided it would be worth going the extra mile to document it and make it useable for other projects. Okku is the result. Enjoy.