Added docs about Push/Pull and Rep/Req ZeroMQ support. Added Windows versions for all command line samples in the Getting Started Guides.

Signed-off-by: Jonas Bonér <jonas@jonasboner.com>
This commit is contained in:
Jonas Bonér 2012-03-05 15:01:40 +01:00
parent 10bb7f678a
commit e555d2a073
5 changed files with 337 additions and 45 deletions

View file

@ -33,22 +33,30 @@ If you want don't want to type in the code and/or set up a Maven project then yo
__ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first __ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first
__ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/java/akka/tutorial/first/java/Pi.java __ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/java/akka/tutorial/first/java/Pi.java
To check out the code using Git invoke the following:: To check out the code using Git invoke the following command and you can then you can navigate down to the tutorial.
On Linux/Unix/Mac systems::
$ git clone git://github.com/akka/akka.git $ git clone git://github.com/akka/akka.git
Then you can navigate down to the tutorial::
$ cd akka/akka-tutorials/akka-tutorial-first $ cd akka/akka-tutorials/akka-tutorial-first
On Windows systems::
C:\Users\jboner\src> git clone git://github.com/akka/akka.git
C:\Users\jboner\src> cd akka\akka-tutorials\akka-tutorial-first
Prerequisites Prerequisites
------------- -------------
This tutorial assumes that you have Java 1.6 or later installed on you machine and ``java`` on your ``PATH``. You also need to know how to run commands in a shell (ZSH, Bash, DOS etc.) and a decent text editor or IDE to type in the Java code. This tutorial assumes that you have Java 1.6 or later installed on you machine and ``java`` on your ``PATH``. You also need to know how to run commands in a shell (ZSH, Bash, DOS etc.) and a decent text editor or IDE to type in the Java code.
You need to make sure that ``$JAVA_HOME`` environment variable is set to the root of the Java distribution. You also need to make sure that the ``$JAVA_HOME/bin`` is on your ``PATH``:: You need to make sure that ``$JAVA_HOME`` environment variable is set to the
root of the Java distribution. You also need to make sure that the
``$JAVA_HOME/bin`` is on your ``PATH``.
$ export JAVA_HOME=..root of java distribution.. On Linux/Unix/Mac systems::
$ export JAVA_HOME=..root of Java distribution..
$ export PATH=$PATH:$JAVA_HOME/bin $ export PATH=$PATH:$JAVA_HOME/bin
You can test your installation by invoking ``java``:: You can test your installation by invoking ``java``::
@ -58,6 +66,17 @@ You can test your installation by invoking ``java``::
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
On Windows systems::
C:\Users\jboner\src\akka> set JAVA_HOME=..root of Java distribution..
C:\Users\jboner\src\akka> set PATH=%PATH%;%JAVA_HOME%/bin
You can test your installation by invoking ``java``::
C:\Users\jboner\src\akka> java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Downloading and installing Akka Downloading and installing Akka
------------------------------- -------------------------------
@ -75,14 +94,25 @@ would like to have Akka installed in. In my case I choose to install it in
You need to do one more thing in order to install Akka properly: set the You need to do one more thing in order to install Akka properly: set the
``AKKA_HOME`` environment variable to the root of the distribution. In my case ``AKKA_HOME`` environment variable to the root of the distribution. In my case
I'm opening up a shell, navigating down to the distribution, and setting the I'm opening up a shell, navigating down to the distribution, and setting the
``AKKA_HOME`` variable:: ``AKKA_HOME`` variable.
On Linux/Unix/Mac systems::
$ cd /Users/jboner/tools/akka-2.1-SNAPSHOT $ cd /Users/jboner/tools/akka-2.1-SNAPSHOT
$ export AKKA_HOME=`pwd` $ export AKKA_HOME=`pwd`
$ echo $AKKA_HOME $ echo $AKKA_HOME
/Users/jboner/tools/akka-2.1-SNAPSHOT /Users/jboner/tools/akka-2.1-SNAPSHOT
The distribution looks like this:: On Windows systems::
C:\Users\jboner\src\akka> cd akka-2.1-SNAPSHOT
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> set AKKA_HOME=%cd%
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> echo %AKKA_HOME%
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT
The distribution looks like this.
On Linux/Unix/Mac systems::
$ ls -1 $ ls -1
bin bin
@ -92,6 +122,16 @@ The distribution looks like this::
lib lib
src src
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> dir
bin
config
deploy
doc
lib
src
- In the ``bin`` directory we have scripts for starting the Akka Microkernel. - In the ``bin`` directory we have scripts for starting the Akka Microkernel.
- In the ``config`` directory we have the Akka conf files. - In the ``config`` directory we have the Akka conf files.
- In the ``deploy`` directory we can place applications to be run with the microkernel. - In the ``deploy`` directory we can place applications to be run with the microkernel.
@ -139,7 +179,9 @@ To install Maven it is easiest to follow the instructions on `http://maven.apach
Creating an Akka Maven project Creating an Akka Maven project
------------------------------ ------------------------------
If you have not already done so, now is the time to create a Maven project for our tutorial. You do that by stepping into the directory you want to create your project in and invoking the ``mvn`` command:: If you have not already done so, now is the time to create a Maven project for our tutorial. You do that by stepping into the directory you want to create your project in and invoking the ``mvn`` command.
On Linux/Unix/Mac systems::
$ mvn archetype:generate \ $ mvn archetype:generate \
-DgroupId=akka.tutorial.first.java \ -DgroupId=akka.tutorial.first.java \
@ -147,10 +189,24 @@ If you have not already done so, now is the time to create a Maven project for o
-DarchetypeArtifactId=maven-archetype-quickstart \ -DarchetypeArtifactId=maven-archetype-quickstart \
-DinteractiveMode=false -DinteractiveMode=false
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> mvn archetype:generate \
-DgroupId=akka.tutorial.first.java \
-DartifactId=akka-tutorial-first-java \
-DarchetypeArtifactId=maven-archetype-quickstart \
-DinteractiveMode=false
Now we have the basis for our Maven-based Akka project. Let's step into the project directory:: Now we have the basis for our Maven-based Akka project. Let's step into the project directory::
On Linux/Unix/Mac systems::
$ cd akka-tutorial-first-java $ cd akka-tutorial-first-java
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> cd akka-tutorial-first-java
Here is the layout that Maven created:: Here is the layout that Maven created::
akka-tutorial-first-jboner akka-tutorial-first-jboner
@ -362,39 +418,73 @@ time. When that's done open up a shell and step in to the Akka distribution
First we need to compile the source file. That is done with Java's compiler First we need to compile the source file. That is done with Java's compiler
``javac``. Our application depends on the ``akka-actor-2.1-SNAPSHOT.jar`` and the ``javac``. Our application depends on the ``akka-actor-2.1-SNAPSHOT.jar`` and the
``scala-library.jar`` JAR files, so let's add them to the compiler classpath ``scala-library.jar`` JAR files, so let's add them to the compiler classpath
when we compile the source:: when we compile the source.
On Linux/Unix/Mac systems::
$ javac -cp lib/scala-library.jar:lib/akka/akka-actor-2.1-SNAPSHOT.jar tutorial/akka/tutorial/first/java/Pi.java $ javac -cp lib/scala-library.jar:lib/akka/akka-actor-2.1-SNAPSHOT.jar tutorial/akka/tutorial/first/java/Pi.java
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> javac -cp \
lib/scala-library.jar;lib/akka/akka-actor-2.1-SNAPSHOT.jar \
tutorial/akka/tutorial/first/java/Pi.java
When we have compiled the source file we are ready to run the application. This When we have compiled the source file we are ready to run the application. This
is done with ``java`` but yet again we need to add the ``akka-actor-2.1-SNAPSHOT.jar`` is done with ``java`` but yet again we need to add the ``akka-actor-2.1-SNAPSHOT.jar``
and the ``scala-library.jar`` JAR files to the classpath as well as the classes and the ``scala-library.jar`` JAR files to the classpath as well as the classes
we compiled ourselves:: we compiled ourselves.
On Linux/Unix/Mac systems::
$ java \ $ java \
-cp lib/scala-library.jar:lib/akka/akka-actor-2.1-SNAPSHOT.jar:. \ -cp lib/scala-library.jar:lib/akka/akka-actor-2.1-SNAPSHOT.jar:. \
akka.tutorial.java.first.Pi akka.tutorial.first.scala.Pi
Pi approximation: 3.1435501812459323
Calculation time: 359 millis
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> java \
-cp lib/scala-library.jar;lib\akka\akka-actor-2.1-SNAPSHOT.jar;. \
akka.tutorial.first.scala.Pi
Pi approximation: 3.1435501812459323 Pi approximation: 3.1435501812459323
Calculation time: 359 millis Calculation time: 359 millis
Yippee! It is working. Yippee! It is working.
Run it inside Maven Run it inside Maven
------------------- -------------------
If you used Maven, then you can run the application directly inside Maven. First you need to compile the project:: If you used Maven, then you can run the application directly inside Maven. First you need to compile the project.
On Linux/Unix/Mac systems::
$ mvn compile $ mvn compile
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> mvn compile
When this in done we can run our application directly inside Maven:: When this in done we can run our application directly inside Maven::
On Linux/Unix/Mac systems::
$ mvn exec:java -Dexec.mainClass="akka.tutorial.first.java.Pi" $ mvn exec:java -Dexec.mainClass="akka.tutorial.first.java.Pi"
... ...
Pi approximation: 3.1435501812459323 Pi approximation: 3.1435501812459323
Calculation time: 359 millis Calculation time: 359 millis
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> mvn exec:java \
-Dexec.mainClass="akka.tutorial.first.java.Pi"
...
Pi approximation: 3.1435501812459323
Calculation time: 359 millis
Yippee! It is working. Yippee! It is working.
Overriding Configuration Externally (Optional) Overriding Configuration Externally (Optional)

View file

@ -49,14 +49,17 @@ check out the full tutorial from the Akka GitHub repository. It is in the
__ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first __ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first
__ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/Pi.scala __ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/Pi.scala
To check out the code using Git invoke the following:: To check out the code using Git invoke the following command and you can then you can navigate down to the tutorial.
On Linux/Unix/Mac systems::
$ git clone git://github.com/akka/akka.git $ git clone git://github.com/akka/akka.git
Then you can navigate down to the tutorial::
$ cd akka/akka-tutorials/akka-tutorial-first $ cd akka/akka-tutorials/akka-tutorial-first
On Windows systems::
C:\Users\jboner\src> git clone git://github.com/akka/akka.git
C:\Users\jboner\src> cd akka\akka-tutorials\akka-tutorial-first
Prerequisites Prerequisites
------------- -------------
@ -68,9 +71,11 @@ code.
You need to make sure that ``$JAVA_HOME`` environment variable is set to the You need to make sure that ``$JAVA_HOME`` environment variable is set to the
root of the Java distribution. You also need to make sure that the root of the Java distribution. You also need to make sure that the
``$JAVA_HOME/bin`` is on your ``PATH``:: ``$JAVA_HOME/bin`` is on your ``PATH``.
$ export JAVA_HOME=..root of java distribution.. On Linux/Unix/Mac systems::
$ export JAVA_HOME=..root of Java distribution..
$ export PATH=$PATH:$JAVA_HOME/bin $ export PATH=$PATH:$JAVA_HOME/bin
You can test your installation by invoking ``java``:: You can test your installation by invoking ``java``::
@ -80,6 +85,17 @@ You can test your installation by invoking ``java``::
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
On Windows systems::
C:\Users\jboner\src\akka> set JAVA_HOME=..root of Java distribution..
C:\Users\jboner\src\akka> set PATH=%PATH%;%JAVA_HOME%/bin
You can test your installation by invoking ``java``::
C:\Users\jboner\src\akka> java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Downloading and installing Akka Downloading and installing Akka
------------------------------- -------------------------------
@ -97,14 +113,26 @@ would like to have Akka installed in. In my case I choose to install it in
You need to do one more thing in order to install Akka properly: set the You need to do one more thing in order to install Akka properly: set the
``AKKA_HOME`` environment variable to the root of the distribution. In my case ``AKKA_HOME`` environment variable to the root of the distribution. In my case
I'm opening up a shell, navigating down to the distribution, and setting the I'm opening up a shell, navigating down to the distribution, and setting the
``AKKA_HOME`` variable:: ``AKKA_HOME`` variable.
On Linux/Unix/Mac systems::
$ cd /Users/jboner/tools/akka-2.1-SNAPSHOT $ cd /Users/jboner/tools/akka-2.1-SNAPSHOT
$ export AKKA_HOME=`pwd` $ export AKKA_HOME=`pwd`
$ echo $AKKA_HOME $ echo $AKKA_HOME
/Users/jboner/tools/akka-2.1-SNAPSHOT /Users/jboner/tools/akka-2.1-SNAPSHOT
The distribution looks like this:: On Windows systems::
C:\Users\jboner\src\akka> cd akka-2.1-SNAPSHOT
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> set AKKA_HOME=%cd%
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> echo %AKKA_HOME%
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT
The distribution looks like this.
On Linux/Unix/Mac systems::
$ ls -1 $ ls -1
bin bin
@ -114,6 +142,16 @@ The distribution looks like this::
lib lib
src src
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> dir
bin
config
deploy
doc
lib
src
- In the ``bin`` directory we have scripts for starting the Akka Microkernel. - In the ``bin`` directory we have scripts for starting the Akka Microkernel.
- In the ``config`` directory we have the Akka conf files. - In the ``config`` directory we have the Akka conf files.
- In the ``deploy`` directory we can place applications to be run with the microkernel. - In the ``deploy`` directory we can place applications to be run with the microkernel.
@ -156,7 +194,7 @@ This plugin comes with its own version of Scala, so if you don't plan to run the
you don't need to download the Scala distribution (and you can skip the next section). you don't need to download the Scala distribution (and you can skip the next section).
You can install this plugin using the regular update mechanism. First choose a version of the IDE from You can install this plugin using the regular update mechanism. First choose a version of the IDE from
`http://download.scala-ide.org <http://download.scala-ide.org>`_. We recommend you choose 2.0.x, which `http://download.scala-ide.org <http://download.scala-ide.org>`_. We recommend you choose 2.1.x, which
comes with Scala 2.9. Copy the corresponding URL and then choose ``Help/Install New Software`` and paste comes with Scala 2.9. Copy the corresponding URL and then choose ``Help/Install New Software`` and paste
the URL you just copied. You should see something similar to the following image. the URL you just copied. You should see something similar to the following image.
@ -191,15 +229,27 @@ distribution then just unzip it where you want it installed. If you pick the
IzPack Installer then double click on it and follow the instructions. IzPack Installer then double click on it and follow the instructions.
You also need to make sure that the ``scala-2.9.1/bin`` (if that is the You also need to make sure that the ``scala-2.9.1/bin`` (if that is the
directory where you installed Scala) is on your ``PATH``:: directory where you installed Scala) is on your ``PATH``.
On Linux/Unix/Mac systems::
$ export PATH=$PATH:scala-2.9.1/bin $ export PATH=$PATH:scala-2.9.1/bin
You can test your installation by invoking scala:: On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> set PATH=%PATH%;scala-2.9.1\bin
You can test your installation by invoking scala.
On Linux/Unix/Mac systems::
$ scala -version $ scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL
Looks like we are all good. Finally let's create a source file ``Pi.scala`` for Looks like we are all good. Finally let's create a source file ``Pi.scala`` for
the tutorial and put it in the root of the Akka distribution in the ``tutorial`` the tutorial and put it in the root of the Akka distribution in the ``tutorial``
directory (you have to create it first). directory (you have to create it first).
@ -228,16 +278,30 @@ instruction and additionally install the ``sbteclipse`` plugin. This adds suppor
from your SBT project. You need to install the plugin as described in the `README of sbteclipse from your SBT project. You need to install the plugin as described in the `README of sbteclipse
<https://github.com/typesafehub/sbteclipse>`_ <https://github.com/typesafehub/sbteclipse>`_
Then run the ``eclipse`` target to generate the Eclipse project:: Then run the ``eclipse`` target to generate the Eclipse project.
On Linux/Unix/Mac systems::
$ sbt $ sbt
> eclipse > eclipse
The options `create-src` and `with-sources` are useful:: On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> sbt
> eclipse
The options `create-src` and `with-sources` are useful:
On Linux/Unix/Mac systems::
$ sbt $ sbt
> eclipse create-src with-sources > eclipse create-src with-sources
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> sbt
> eclipse create-src with-sources
* create-src to create the common source directories, e.g. src/main/scala, src/main/test * create-src to create the common source directories, e.g. src/main/scala, src/main/test
* with-sources to create source attachments for the library dependencies * with-sources to create source attachments for the library dependencies
@ -410,7 +474,7 @@ If everything works fine, you should see::
Calculation time: 359 millis Calculation time: 359 millis
You can also define a new Run configuration, by going to ``Run/Run Configurations``. Create a new ``Scala application`` You can also define a new Run configuration, by going to ``Run/Run Configurations``. Create a new ``Scala application``
and choose the tutorial project and the main class to be ``akkatutorial.Pi``. You can pass additional command line and choose the tutorial project and the main class to be ``akka/tutorial.Pi``. You can pass additional command line
arguments to the JVM on the ``Arguments`` page, for instance to define where :ref:`configuration` is: arguments to the JVM on the ``Arguments`` page, for instance to define where :ref:`configuration` is:
.. image:: ../images/run-config.png .. image:: ../images/run-config.png

View file

@ -51,14 +51,18 @@ check out the full tutorial from the Akka GitHub repository. It is in the
__ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first __ https://github.com/akka/akka/tree/master/akka-tutorials/akka-tutorial-first
__ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/akka/tutorial/first/scala/Pi.scala __ https://github.com/akka/akka/blob/master/akka-tutorials/akka-tutorial-first/src/main/scala/akka/tutorial/first/scala/Pi.scala
To check out the code using Git invoke the following:: To check out the code using Git invoke the following command and you can then you can navigate down to the tutorial.
On Linux/Unix/Mac systems::
$ git clone git://github.com/akka/akka.git $ git clone git://github.com/akka/akka.git
Then you can navigate down to the tutorial::
$ cd akka/akka-tutorials/akka-tutorial-first $ cd akka/akka-tutorials/akka-tutorial-first
On Windows systems::
C:\Users\jboner\src> git clone git://github.com/akka/akka.git
C:\Users\jboner\src> cd akka\akka-tutorials\akka-tutorial-first
Prerequisites Prerequisites
============= =============
@ -69,9 +73,11 @@ code.
You need to make sure that ``$JAVA_HOME`` environment variable is set to the You need to make sure that ``$JAVA_HOME`` environment variable is set to the
root of the Java distribution. You also need to make sure that the root of the Java distribution. You also need to make sure that the
``$JAVA_HOME/bin`` is on your ``PATH``:: ``$JAVA_HOME/bin`` is on your ``PATH``.
$ export JAVA_HOME=..root of java distribution.. On Linux/Unix/Mac systems::
$ export JAVA_HOME=..root of Java distribution..
$ export PATH=$PATH:$JAVA_HOME/bin $ export PATH=$PATH:$JAVA_HOME/bin
You can test your installation by invoking ``java``:: You can test your installation by invoking ``java``::
@ -81,6 +87,17 @@ You can test your installation by invoking ``java``::
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326) Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode) Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
On Windows systems::
C:\Users\jboner\src\akka> set JAVA_HOME=..root of Java distribution..
C:\Users\jboner\src\akka> set PATH=%PATH%;%JAVA_HOME%/bin
You can test your installation by invoking ``java``::
C:\Users\jboner\src\akka> java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07-334-10M3326)
Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode)
Downloading and installing Akka Downloading and installing Akka
=============================== ===============================
@ -98,14 +115,25 @@ would like to have Akka installed in. In my case I choose to install it in
You need to do one more thing in order to install Akka properly: set the You need to do one more thing in order to install Akka properly: set the
``AKKA_HOME`` environment variable to the root of the distribution. In my case ``AKKA_HOME`` environment variable to the root of the distribution. In my case
I'm opening up a shell, navigating down to the distribution, and setting the I'm opening up a shell, navigating down to the distribution, and setting the
``AKKA_HOME`` variable:: ``AKKA_HOME`` variable.
On Linux/Unix/Mac systems::
$ cd /Users/jboner/tools/akka-2.1-SNAPSHOT $ cd /Users/jboner/tools/akka-2.1-SNAPSHOT
$ export AKKA_HOME=`pwd` $ export AKKA_HOME=`pwd`
$ echo $AKKA_HOME $ echo $AKKA_HOME
/Users/jboner/tools/akka-2.1-SNAPSHOT /Users/jboner/tools/akka-2.1-SNAPSHOT
The distribution looks like this:: On Windows systems::
C:\Users\jboner\src\akka> cd akka-2.1-SNAPSHOT
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> set AKKA_HOME=%cd%
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> echo %AKKA_HOME%
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT
The distribution looks like this.
On Linux/Unix/Mac systems::
$ ls -1 $ ls -1
bin bin
@ -115,6 +143,16 @@ The distribution looks like this::
lib lib
src src
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> dir
bin
config
deploy
doc
lib
src
- In the ``bin`` directory we have scripts for starting the Akka Microkernel. - In the ``bin`` directory we have scripts for starting the Akka Microkernel.
- In the ``config`` directory we have the Akka conf files. - In the ``config`` directory we have the Akka conf files.
- In the ``deploy`` directory we can place applications to be run with the microkernel. - In the ``deploy`` directory we can place applications to be run with the microkernel.
@ -163,15 +201,28 @@ distribution then just unzip it where you want it installed. If you pick the
IzPack Installer then double click on it and follow the instructions. IzPack Installer then double click on it and follow the instructions.
You also need to make sure that the ``scala-2.9.1/bin`` (if that is the You also need to make sure that the ``scala-2.9.1/bin`` (if that is the
directory where you installed Scala) is on your ``PATH``:: directory where you installed Scala) is on your ``PATH``.
On Linux/Unix/Mac systems::
$ export PATH=$PATH:scala-2.9.1/bin $ export PATH=$PATH:scala-2.9.1/bin
You can test your installation by invoking scala:: On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> set PATH=%PATH%;scala-2.9.1\bin
You can test your installation by invoking scala.
On Linux/Unix/Mac systems::
$ scala -version $ scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> scala -version
Scala code runner version 2.9.1.final -- Copyright 2002-2011, LAMP/EPFL
Looks like we are all good. Finally let's create a source file ``Pi.scala`` for Looks like we are all good. Finally let's create a source file ``Pi.scala`` for
the tutorial and put it in the root of the Akka distribution in the ``tutorial`` the tutorial and put it in the root of the Akka distribution in the ``tutorial``
directory (you have to create it first). directory (you have to create it first).
@ -404,15 +455,23 @@ When that's done open up a shell and step in to the Akka distribution (``cd $AKK
First we need to compile the source file. That is done with Scala's compiler First we need to compile the source file. That is done with Scala's compiler
``scalac``. Our application depends on the ``akka-actor-2.1-SNAPSHOT.jar`` JAR ``scalac``. Our application depends on the ``akka-actor-2.1-SNAPSHOT.jar`` JAR
file, so let's add that to the compiler classpath when we compile the source:: file, so let's add that to the compiler classpath when we compile the source.
On Linux/Unix/Mac systems::
$ scalac -cp lib/akka/akka-actor-2.1-SNAPSHOT.jar Pi.scala $ scalac -cp lib/akka/akka-actor-2.1-SNAPSHOT.jar Pi.scala
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> scalac -cp lib\akka\akka-actor-2.1-SNAPSHOT.jar Pi.scala
When we have compiled the source file we are ready to run the application. This When we have compiled the source file we are ready to run the application. This
is done with ``java`` but yet again we need to add the is done with ``java`` but yet again we need to add the
``akka-actor-2.1-SNAPSHOT.jar`` JAR file to the classpath, and this time we also ``akka-actor-2.1-SNAPSHOT.jar`` JAR file to the classpath, and this time we also
need to add the Scala runtime library ``scala-library.jar`` and the classes we need to add the Scala runtime library ``scala-library.jar`` and the classes we
compiled ourselves:: compiled ourselves.
On Linux/Unix/Mac systems::
$ java \ $ java \
-cp lib/scala-library.jar:lib/akka/akka-actor-2.1-SNAPSHOT.jar:. \ -cp lib/scala-library.jar:lib/akka/akka-actor-2.1-SNAPSHOT.jar:. \
@ -421,18 +480,35 @@ compiled ourselves::
Pi approximation: 3.1435501812459323 Pi approximation: 3.1435501812459323
Calculation time: 359 millis Calculation time: 359 millis
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> java \
-cp lib/scala-library.jar;lib\akka\akka-actor-2.1-SNAPSHOT.jar;. \
akka.tutorial.first.scala.Pi
Pi approximation: 3.1435501812459323
Calculation time: 359 millis
Yippee! It is working. Yippee! It is working.
Run it inside SBT Run it inside SBT
================= =================
If you used SBT, then you can run the application directly inside SBT. First you If you used SBT, then you can run the application directly inside SBT. First you
need to compile the project:: need to compile the project.
On Linux/Unix/Mac systems::
$ sbt $ sbt
> compile > compile
... ...
On Windows systems::
C:\Users\jboner\src\akka\akka-2.1-SNAPSHOT> sbt
> compile
...
When this in done we can run our application directly inside SBT:: When this in done we can run our application directly inside SBT::
> run > run

View file

@ -34,7 +34,7 @@ Similarly you can create a subscription socket, with a listener, that subscribes
The following sub-sections describe the supported connection patterns and how they can be used in an Akka environment. However, for a comprehensive discussion of connection patterns, please refer to `ZeroMQ -- The Guide <http://zguide.zeromq.org/page:all>`_. The following sub-sections describe the supported connection patterns and how they can be used in an Akka environment. However, for a comprehensive discussion of connection patterns, please refer to `ZeroMQ -- The Guide <http://zguide.zeromq.org/page:all>`_.
Publisher-subscriber connection Publisher-Subscriber Connection
------------------------------- -------------------------------
In a publisher-subscriber (pub-sub) connection, the publisher accepts one or more subscribers. Each subscriber shall In a publisher-subscriber (pub-sub) connection, the publisher accepts one or more subscribers. Each subscriber shall
@ -84,7 +84,7 @@ Another subscriber keep track of used heap and warns if too much heap is used. I
.. includecode:: code/akka/docs/zeromq/ZeromqDocTestBase.java#alerter2 .. includecode:: code/akka/docs/zeromq/ZeromqDocTestBase.java#alerter2
Router-Dealer connection Router-Dealer Connection
------------------------ ------------------------
While Pub/Sub is nice the real advantage of zeromq is that it is a "lego-box" for reliable messaging. And because there are so many integrations the multi-language support is fantastic. While Pub/Sub is nice the real advantage of zeromq is that it is a "lego-box" for reliable messaging. And because there are so many integrations the multi-language support is fantastic.
@ -96,3 +96,34 @@ To create a Router socket that has a high watermark configured, you would do:
.. includecode:: code/akka/docs/zeromq/ZeromqDocTestBase.java#high-watermark .. includecode:: code/akka/docs/zeromq/ZeromqDocTestBase.java#high-watermark
The akka-zeromq module accepts most if not all the available configuration options for a zeromq socket. The akka-zeromq module accepts most if not all the available configuration options for a zeromq socket.
Push-Pull Connection
--------------------
Akka ZeroMQ module supports ``Push-Pull`` connections.
You can create a ``Push`` connection through the::
ActorRef newPushSocket(SocketOption[] socketParameters);
You can create a ``Pull`` connection through the::
ActorRef newPullSocket(SocketOption[] socketParameters);
More documentation and examples will follow soon.
Rep-Req Connection
------------------
Akka ZeroMQ module supports ``Rep-Req`` connections.
You can create a ``Rep`` connection through the::
ActorRef newRepSocket(SocketOption[] socketParameters);
You can create a ``Req`` connection through the::
ActorRef newReqSocket(SocketOption[] socketParameters);
More documentation and examples will follow soon.

View file

@ -38,7 +38,7 @@ Similarly you can create a subscription socket, with a listener, that subscribes
The following sub-sections describe the supported connection patterns and how they can be used in an Akka environment. However, for a comprehensive discussion of connection patterns, please refer to `ZeroMQ -- The Guide <http://zguide.zeromq.org/page:all>`_. The following sub-sections describe the supported connection patterns and how they can be used in an Akka environment. However, for a comprehensive discussion of connection patterns, please refer to `ZeroMQ -- The Guide <http://zguide.zeromq.org/page:all>`_.
Publisher-subscriber connection Publisher-Subscriber Connection
------------------------------- -------------------------------
In a publisher-subscriber (pub-sub) connection, the publisher accepts one or more subscribers. Each subscriber shall In a publisher-subscriber (pub-sub) connection, the publisher accepts one or more subscribers. Each subscriber shall
@ -82,7 +82,7 @@ Another subscriber keep track of used heap and warns if too much heap is used. I
.. includecode:: code/akka/docs/zeromq/ZeromqDocSpec.scala#alerter .. includecode:: code/akka/docs/zeromq/ZeromqDocSpec.scala#alerter
Router-Dealer connection Router-Dealer Connection
------------------------ ------------------------
While Pub/Sub is nice the real advantage of zeromq is that it is a "lego-box" for reliable messaging. And because there are so many integrations the multi-language support is fantastic. While Pub/Sub is nice the real advantage of zeromq is that it is a "lego-box" for reliable messaging. And because there are so many integrations the multi-language support is fantastic.
@ -94,3 +94,34 @@ To create a Router socket that has a high watermark configured, you would do:
.. includecode:: code/akka/docs/zeromq/ZeromqDocSpec.scala#high-watermark .. includecode:: code/akka/docs/zeromq/ZeromqDocSpec.scala#high-watermark
The akka-zeromq module accepts most if not all the available configuration options for a zeromq socket. The akka-zeromq module accepts most if not all the available configuration options for a zeromq socket.
Push-Pull Connection
--------------------
Akka ZeroMQ module supports ``Push-Pull`` connections.
You can create a ``Push`` connection through the::
def newPushSocket(socketParameters: Array[SocketOption]): ActorRef
You can create a ``Pull`` connection through the::
def newPullSocket(socketParameters: Array[SocketOption]): ActorRef
More documentation and examples will follow soon.
Rep-Req Connection
------------------
Akka ZeroMQ module supports ``Rep-Req`` connections.
You can create a ``Rep`` connection through the::
def newReqSocket(socketParameters: Array[SocketOption]): ActorRef
You can create a ``Req`` connection through the::
def newRepSocket(socketParameters: Array[SocketOption]): ActorRef
More documentation and examples will follow soon.