Question

I have Scala IDE already setup because I used it for Coursera course "Functional Programming Principles in Scala" by Martin Odersky.

Now i want to use Akka framework in the same IDE.

Is there any Scala IDE Akka plugin available which i can import directly?

I tried to reference all the akka provided jars in a new Scala Project. I am able to run the basic akka example this way.

But when I try to work with Dispatchers, the code is not compiling.

object TestActor {
    val dispatcher = Dispatchers.newExecutorBasedEventDrivenWorkStealingDispatcher("pool")
               .setCorePoolSize(100)
               .setMaxPoolSize(100)
               .build
}

I am trying to use Akka 2.0.2 on Scala 2.9

What is the surest way to configure and run akka 2.0.2 or 2.0.4 in Scala IDE?

Was it helpful?

Solution

You're mixing up Akka 1.x APIs (Dispatcher.newXXX) with Akka 2.0 APIs. Please refer to the reference documentation: http://doc.akka.io/docs/akka/2.0.4/

OTHER TIPS

For setting up a quick and dirty Akka 2.0.2 project in IntelliJ, I've had the best luck using Maven. My guess is you could probably get Scala IDE to use Maven to pull in the dependencies using something like what I show below. My pom.xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
         http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <name>myProject</name>
    <groupId>myProject</groupId>
    <artifactId>myProject</artifactId>
    <packaging>jar</packaging>
    <version>0.1</version>
    <url>http://example.com</url>

    <dependencies>
        <dependency>
            <groupId>com.typesafe.akka</groupId>
            <artifactId>akka-actor</artifactId>
            <version>2.0.2</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.9.0-1</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>typesafe</id>
            <name>Typesafe Repository</name>
            <url>http://repo.typesafe.com/typesafe/releases/</url>
        </repository>
    </repositories>
</project>

Here is the surest way.

I was in the same situation as you - I just finished the coursera class, had the integrated Scala IDE set up, want to explore Akka. Here is what I found.

Go to Installing the Typesafe Stack. Follow the instructions for setting up scala, sbt, giter8 etc. for your machine. Go to Getting Started With Akka (Scala). This will take you through how to use the Typesafe templates to get an Akka project set up just like you were used to in the coursera class. Pay special attention to "Setting up The Scala IDE for Eclipse (optional)". Adding that, you will have a Scala project, with all the Akka dependencies installed, ready to develop in Eclipse. You'll feel right at home.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top