| career | drupal | java | mac | mysql | perl | scala | uml | unix  

Akka/Scala example source code file (getting-started.rst)

This example Akka source code file (getting-started.rst) is included in my "Source Code Warehouse" project. The intent of this project is to help you more easily find Akka and Scala source code examples by using tags.

All credit for the original source code belongs to; I'm just trying to make examples easier to find. (For my Scala work, see my Scala examples and tutorials.)

Akka tags/keywords

akka, for, java, maven, sbt, scala, the, typesafe, using, you

The getting-started.rst Akka example source code

Getting Started


Akka requires that you have `Java 1.6 <>`_ or
later installed on you machine.

Getting Started Guides and Template Projects

The best way to start learning Akka is to download `Typesafe Activator <>`_
and try out one of Akka Template Projects.


There are several ways to download Akka. You can download it as part of the Typesafe Platform
(as described above). You can download the full distribution with microkernel, which includes
all modules. Or you can use a build tool like Maven or SBT to download dependencies from the
Akka Maven repository.


Akka is very modular and consists of several JARs containing different features.

- ``akka-actor`` – Classic Actors, Typed Actors, IO Actor etc.

- ``akka-agent`` – Agents, integrated with Scala STM

- ``akka-camel`` – Apache Camel integration

- ``akka-cluster`` – Cluster membership management, elastic routers.

- ``akka-kernel`` – Akka microkernel for running a bare-bones mini application

- ``akka-osgi`` – base bundle for using Akka in OSGi containers, containing the
  ``akka-actor`` classes

- ``akka-osgi-aries`` – Aries blueprint for provisioning actor systems

- ``akka-remote`` – Remote Actors

- ``akka-slf4j`` – SLF4J Logger (event bus listener)

- ``akka-testkit`` – Toolkit for testing Actor systems

- ``akka-zeromq`` – ZeroMQ integration

In addition to these stable modules there are several which are on their way
into the stable core but are still marked “experimental” at this point. This
does not mean that they do not function as intended, it primarily means that
their API has not yet solidified enough in order to be considered frozen. You
can help accelerating this process by giving feedback on these modules on our
mailing list.

- ``akka-contrib`` – an assortment of contributions which may or may not be
  moved into core modules, see :ref:`akka-contrib` for more details.

The filename of the actual JAR is for example ``@jarName@`` (and analog for
the other modules).

How to see the JARs dependencies of each Akka module is described in the
:ref:`dependencies` section.

Using a release distribution

Download the release you need from and unzip it.

Using a snapshot version

The Akka nightly snapshots are published to and are
versioned with both ``SNAPSHOT`` and timestamps. You can choose a timestamped
version to work with and can decide when to update to a newer version. The Akka
snapshots repository is also proxied through
which includes proxies for several other repositories that Akka modules depend on.

.. warning::

  The use of Akka SNAPSHOTs, nightlies and milestone releases is discouraged unless you know what you are doing.


The Akka distribution includes the microkernel. To run the microkernel put your
application jar in the ``deploy`` directory and use the scripts in the ``bin``

More information is available in the documentation of the
:ref:`Microkernel (Scala) <microkernel-scala>` / :ref:`Microkernel (Java) <microkernel-java>`.

.. _build-tool:

Using a build tool

Akka can be used with build tools that support Maven repositories.

Maven repositories

For Akka version 2.1-M2 and onwards:

`Maven Central <>`_

For previous Akka versions:

`Akka Repo <>`_
`Typesafe Repo <>`_

Using Akka with Maven

The simplest way to get started with Akka and Maven is to check out the
`Typesafe Activator <>`_
tutorial named `Akka Main in Java <>`_.

Since Akka is published to Maven Central (for versions since 2.1-M2), it is
enough to add the Akka dependencies to the POM. For example, here is the
dependency for akka-actor:

.. code-block:: xml


For snapshot versions, the snapshot repository needs to be added as well:

.. code-block:: xml


**Note**: for snapshot versions both ``SNAPSHOT`` and timestamped versions are published.

Using Akka with SBT

The simplest way to get started with Akka and SBT is to check out the
`Akka/SBT template <>`_

Summary of the essential parts for using Akka with SBT:

SBT installation instructions on ` <>`_

``build.sbt`` file:

.. parsed-literal::

    name := "My Project"

    version := "1.0"

    scalaVersion := "@scalaVersion@"

    libraryDependencies +=
      "com.typesafe.akka" %% "akka-actor" % "@version@" @crossString@

**Note**: the libraryDependencies setting above is specific to SBT v0.12.x and higher.  If you are using an older version of SBT, the libraryDependencies should look like this:

.. parsed-literal::

    libraryDependencies +=
      "com.typesafe.akka" % "akka-actor_@binVersion@" % "@version@"

For snapshot versions, the snapshot repository needs to be added as well:

.. parsed-literal::

    resolvers += "Akka Snapshot Repository" at ""

Using Akka with Gradle

Requires at least `Gradle <>`_ 1.4
Uses the `Scala plugin <>`_

.. parsed-literal::

    apply plugin: 'scala'

    repositories {

    dependencies {
      compile 'org.scala-lang:scala-library:@scalaVersion@'

    tasks.withType(ScalaCompile) {
      scalaCompileOptions.useAnt = false

    dependencies {
      compile group: 'com.typesafe.akka', name: 'akka-actor_@binVersion@', version: '@version@'
      compile group: 'org.scala-lang', name: 'scala-library', version: '@scalaVersion@'

For snapshot versions, the snapshot repository needs to be added as well:

.. parsed-literal::

    repositories {
      maven {
        url ""

Using Akka with Eclipse

Setup SBT project and then use `sbteclipse <>`_ to generate a Eclipse project.

Using Akka with IntelliJ IDEA

Setup SBT project and then use `sbt-idea <>`_ to generate a IntelliJ IDEA project.

Using Akka with NetBeans

Setup SBT project and then use `nbsbt <>`_ to generate a NetBeans project.

You should also use `nbscala <>`_ for general scala support in the IDE.

Do not use -optimize Scala compiler flag

.. warning::

  Akka has not been compiled or tested with -optimize Scala compiler flag.
  Strange behavior has been reported by users that have tried it.

Build from sources

Akka uses Git and is hosted at `Github <>`_.

* Akka: clone the Akka repository from `<>`_

Continue reading the page on :ref:`building-akka`

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.

Other Akka source code examples

Here is a short list of links related to this Akka getting-started.rst source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.