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:
parent
10bb7f678a
commit
e555d2a073
5 changed files with 337 additions and 45 deletions
|
|
@ -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/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
|
||||
|
||||
Then you can navigate down to the tutorial::
|
||||
|
||||
$ 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
|
||||
-------------
|
||||
|
||||
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
|
||||
|
||||
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 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
|
||||
-------------------------------
|
||||
|
|
@ -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
|
||||
``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
|
||||
``AKKA_HOME`` variable::
|
||||
``AKKA_HOME`` variable.
|
||||
|
||||
On Linux/Unix/Mac systems::
|
||||
|
||||
$ cd /Users/jboner/tools/akka-2.1-SNAPSHOT
|
||||
$ export AKKA_HOME=`pwd`
|
||||
$ echo $AKKA_HOME
|
||||
/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
|
||||
bin
|
||||
|
|
@ -92,6 +122,16 @@ The distribution looks like this::
|
|||
lib
|
||||
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 ``config`` directory we have the Akka conf files.
|
||||
- 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
|
||||
------------------------------
|
||||
|
||||
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 \
|
||||
-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 \
|
||||
-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::
|
||||
|
||||
On Linux/Unix/Mac systems::
|
||||
|
||||
$ 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::
|
||||
|
||||
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
|
||||
``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
|
||||
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
|
||||
|
||||
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
|
||||
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
|
||||
we compiled ourselves::
|
||||
we compiled ourselves.
|
||||
|
||||
On Linux/Unix/Mac systems::
|
||||
|
||||
$ java \
|
||||
-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
|
||||
Calculation time: 359 millis
|
||||
|
||||
Yippee! It is working.
|
||||
|
||||
|
||||
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
|
||||
|
||||
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::
|
||||
|
||||
On Linux/Unix/Mac systems::
|
||||
|
||||
$ mvn exec:java -Dexec.mainClass="akka.tutorial.first.java.Pi"
|
||||
...
|
||||
Pi approximation: 3.1435501812459323
|
||||
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.
|
||||
|
||||
Overriding Configuration Externally (Optional)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue