Welcome to my blog. Here are my most recent blog posts:
  • Akka and Spray

    July 8, 2013

    This application shows how to build Akka application with Spray API. In this tutorial, I am going to use Spray's spray-can, spray-httpx, spray-json artefacts with the Akka artefacts to build an application that receives HTTP requests with JSON payloads, unmarshals the JSON into instances of our own classes (case classes, to be exact). It then sends these instances to the appropriate Actors for processing. When the actors reply, it marshals the responses into JSON, and uses that to construct the HTTP responses.

  • Spray and Akka IO

    July 8, 2013

    It just so happens that the @akkateam released Akka 2.2. Akka 2.2 includes, amongst others, the new IO. In this post, I will show how to use the 1.2 version of Spray Client with the new Akka IO. I am going to build a simple repository crawler, including tests. You will see just how simple & powerful it is to use the new Akka IO and how nicely Spray integrates into it.

    Alongside Scala 2.10.2, we will be using the following libraries in our example:

    "com.typesafe.akka" %% "akka-actor"   % "2.2.0",
    "com.typesafe.akka" %% "akka-testkit" % "2.2.0",
    "io.spray"           % "spray-client" % "1.2-20130705",
    "org.specs2"        %% "specs2"       % "2.0"

  • Scala Days 2013 talk

    June 12, 2013

    You can follow this cookbook to replay the talk I gave at Scala Days in June 2013.

    Counting coins

    We have a video with coins on a table. We want to process the video, count the coins, and send IM on change of the count. You can follow this code by cloning the repository at https://github.com/janm399/scaladays2013; and then, in sbt, using groll next to move between steps.

    The main components:

    Main components

  • Monitoring Akka

    June 2, 2013

    Imagine that you need to find out how your actors are performing, but without using the Typesafe Console. (You don't actually want to use this code in production, but it is an interesting project to learn.) What we are interested is intercepting the receiveMessage call of the ActorCell class.

    A short introduction to AOP

    We could roll our own build of Akka, but that is not a good idea. Instead, we would like to somehow modify the bytecode of the existing Akka JARs to include our instrumentation code. It turns out that we can use aspect oriented programming to implement cross-cutting concerns in our code.

  • Scala SBT building and publishing

    April 30, 2013

    Akka Extras use the full .scala SBT syntax. This is different from the .sbt syntax, so let us explore how to construct the Scala syntax build, including publishing to Sonatype. We will explore this on the real EigengoBuild object.

    The build object

    The EigengoBuild extends the Build object, which is the project settings. In this file, we will define the modules as well as the root module, which aggregates the child modules. Let's explore the overall stucture.

    object EigengoBuild extends Build {
      // contains the modules and build settings
    object Publish {
      // contains settings for publishing
    object Dependencies {
      // contains dependencies

  • Akka Extras Email

    April 27, 2013

    This is the e-mail Akka Extra, which allows you to easily add simple javax.mail support to your application. My motivatiosn were quite simple:

    • Actor and non-actor API
    • Flexible configuration
    • No classes for Email, Address and such like
    • Flexible error handling

    The first item, actor and non-actor API was easy. I have a trait that you can directly mix in, or you can instantiate an actor that does the dirty work. The second one is yet another trait and appropriate implementations. The third and fourth points get more interesting. Let's now take a look at the code and discuss the main points.

    No classes for Email, Address and such like