Protected
Protected

Getting Started


Use a major release


  1. Download Akka from http://github.com/jboner/akka/downloads
  2. Unzip it.

Now you have two options:
  • Run Akka as a stand-alone service using the microkernel
  • Use Akka's module JARs as dependency libraries in another project

Run the microkernel:
  1. Set the AKKA_HOME environment variable to the root of the Akka distribution.
  2. Run 'java -jar akka_2.8.0-0.9.1.jar'. This will boot up the microkernel and deploy all samples applications from './deploy' dir.

Build from sources


  1. Clone the Akka repository from http://github.com/jboner/akka (Akka uses Git). e.g. use 'git clone git:/ /github.com/jboner/akka.git to clone read-only.
  2. Continue reading the page on how to build and run Akka

The Next Steps


Now you can continue with reading the tutorial and try to build the tutorial sample project step by step. This can be a good starting point before diving into the reference documentation which can be navigated in the left sidebar.

Using Akka with Maven


If you want to use Akka with Maven then you first need to add these dependencies:

<repository>
  <id>Akka</id>
  <name>Akka Maven2 Repository</name>
  <url>http://www.scalablesolutions.se/akka/repository/ </url>
</repository>
 
<repository>
  <id>Multiverse</id>
  <name>Multiverse Maven2 Repository</name>
  <url>http://multiverse.googlecode.com/svn/maven-repository/releases/</url>
</repository>
 
<repository>
  <id>GuiceyFruit</id>
  <name>GuiceyFruit Maven2 Repository</name>
  <url>http://guiceyfruit.googlecode.com/svn/repo/releases/ </url>
</repository>
 
<repository>
  <id>JBoss</id>
  <name>JBoss Maven2 Repository</name>
  <url>https://repository.jboss.org/nexus/content/groups/public/ </url>
</repository>

Then you need to add the Akka dependency:

Example of dependency for Akka 0.9.1 :
<dependency>
  <groupId>se.scalablesolutions.akka</groupId>
  <artifactId>akka-core_2.8.0</artifactId>
  <version>0.9.1</version>
</dependency>
 

Using Akka with SBT


Akka has an SBT plugin which makes it very easy to get started with Akka and SBT.

The Scala version in your SBT project needs to match the version that Akka is built against.

To use the plugin, first add a plugin definition to your SBT project by creating project/plugins/Plugins.scala with:
import sbt._
 
class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
  val akkaPlugin = "se.scalablesolutions.akka" % "akka-sbt-plugin" % "0.9.1"
}
Note: the plugin version matches the Akka version provided. The current release is 0.9.1.


Then mix the AkkaProject trait into your project definition. For example:
class MyProject(info: ProjectInfo) extends DefaultProject(info) with AkkaProject
Note: This adds akka-core as a dependency by default.


If you also want to include other Akka modules there is a convenience method: akkaModule. For example, you can add extra Akka modules by adding any of the following lines to your project class:
val akkaAMQP = akkaModule("amqp")
val akkaCamel = akkaModule("camel")
val akkaHttp = akkaModule("http")
val akkaJTA = akkaModule("jta")
val akkaKernel = akkaModule("kernel")
val akkaCassandra = akkaModule("persistence-cassandra")
val akkaMongo = akkaModule("persistence-mongo")
val akkaRedis = akkaModule("persistence-redis")
val akkaSpring = akkaModule("spring")

Java based project


The simplest way to get started with a Java-based Akka project is to checkout and install Mikael Sundberg's Maven archetype. In order to do that you first need to install:

  • Git - http://git-scm.com
  • Maven - http://maven.apache.org/

Now you can do the following:
  1. git clone git:/ /github.com/bobo/akka_mvn_archetyp
  2. cd akka_mvn_archetyp
  3. mvn install

Then somewhere else in a folder you want your project you run:
mvn archetype:generate -DarchetypeCatalog=local

Then you get some options. Just follow the instructions, choose the correct archetype, choose project name, package name etc., and you should have a project created for you. This project is using Maven as build tool and has two Typed Actors, a ChatServer and a ChatSession. You also have a JUnit. You can try to compile and run the test by invoking:
  1. mvn install
  2. mvn test

From here start making your changes.

If the archetype version is not in sync with the Akka version you downloaded :
  • you must update pom.xml file and change the dependencies
  • you may have to install manually the maven jar dependencies
  • you have to install Redis in order for the maven test to succeed

When maven displays a "BUILD ERROR : Failed to resolve artifact" you have to install manually the jar file, here is an example for Akka_0.9 compiled with scala_2.8.0.RC3 :
  • maven displays an "mvn install:install-file" command line, you have to specify the path of the jar file with the "-Dfile=" option.
  • the path is $AKKA_HOME/lib_managed/scala_2.8.0.RC3/compile/ if you use scala 2.8.0_RC3

Scala based project


If you want to create a Scala based Akka project there is an Akka SBT plugin described above.

Akka Rest Project Template


Another simple way is to check out this sbt template project which has a ready to go setup with sbt, all Akka JARs and Jetty: Akka SBT/Jetty template project. This project is using the Akka JARs from the Akka Maven Repository.

Development Version


If you want to build your project against the latest sources in your Akka distribution in $AKKA_HOME (and are using SBT), then this is a nice trick:
lazy val akkaHome = Path.fromFile(System.getenv("AKKA_HOME"))
override def unmanagedClasspath = (akkaHome / "dist" **"*.jar") +++ (akkaHome / "lib_managed" ** "*.jar")

Need help?


If you have questions you can get help on the Akka Mailing List.

You can also ask for commercial support.

Thanks for being a part of the Akka community.
Home
close
Loading...
Home Turn Off "Getting Started"
close
Loading...