What happened to akka.util.duration?

In a lot of old Akka examples you will see the following statements:

import akka.util.Timeout
import akka.util.duration._
implicit val askTimeout = Timeout(1 second)

This will give error ‘object duration is not a member of package akka.util’. It turns out duration is now included in Scala standard library. To fix the error use the following import statement:

import scala.concurrent.duration._

Check out the migration guide for other pieces of Akka functionality that have moved to Scala.

Executing a method defined in a configuration file

I have a class with a method that takes a function as parameter. This function is the strategy that determines how a file is split into chunks. This is the signature of the method.

def split(r: RemoteFileInfo, append: Boolean, workDir: File, strategy: (Long) => Int = defaultStrategy): LinkedHashSet[Chunk] = {
  ...
}

There is a companion object that provides a number of predefined strategies. I wanted to make the strategy configurable by adding it to the Akka application.conf file. Continue reading

Interesting open source projects to look at

This will be a never ending list of open source projects I want to look into. They look like potential candidates to be used on future projects, but need more thorough analysis.

  • Kamon – Reactive Application Monitoring: Kamon is a Open Source set of tools that help you to get metrics out of your reactive applications built on top of Akka, Spray and Play! Kamon uses bytecode instrumentation to introduce metrics and tracing logic into your application, without you having to modify a single line of code. All the collected information is available through a simple, actor-based messaging protocol with integrations already available out of the box.

Any suggestions you think I should look into?

ClassNotFoundException when adding slf4j to Akka

When adding to a Akka project I got the following error java.lang.ClassNotFoundException: akka.event.slf4j.Slf4jLogger. I double checked my configuration and the Akka documentation. The documentation says the following:

Akka provides a logger for SL4FJ. This module is available in the ‘akka-slf4j.jar’. It has one single dependency; the slf4j-api jar. In runtime you also need a SLF4J backend, we recommend Logback.

No success. Continue reading