Skip to content

Latest commit

 

History

History

akka-cookbook

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Book Akka Cookbook

Akka project Directory akka-cookbook\ contains Akka examples presented in Ortiz's book Akka Cookbook (Packt, 2017).
It also includes different build scripts for experimenting with Akka on a Windows machine.

Code examples can be built/run with the following tools:

Build tool Build file Parent file Environment(s)
ant.bat build.xml build.xml Any a)
gradle.bat build.gradle common.gradle Any
make.exe Makefile Makefile.inc Any
mvn.cmd pom.xml pom.xml Any
sbt.bat build.sbt   Any
cmd.exe build.bat   Windows only
a) Here "Any" means "tested on Windows, Cygwin, MSYS2 and UNIX".

HelloAkka Example

The project directory is organised as follows :

> tree /a /f . | findstr /v /b [A-Z]
|   build.bat
|   build.gradle
|   build.sbt
|   build.sh
|   build.xml
|   gradle.properties
|   Makefile
|   pom.xml
+---project
|       build.properties
\---src
    +---main
    |   +---resources
    |   |       application.conf
    |   |       logback.xml
    |   \---scala
    |           HelloAkka.scala
    \---test
        +---java
        |       HelloAkkaTestJava.java
        \---scala
                HelloAkkaTest.scala

Batch file build.bat matches what a user would run from the command prompt (use option -debug to see the execution details):

> build -verbose run
Compile 1 Scala source file to directory "target\classes"
[HelloAkka-akka.actor.default-dispatcher-4] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
akka://HelloAkka
>>> Press ENTER to exit <<<

🔎 Commands ant.bat (build.xml), gradle.bat (build.gradle), make (Makefile), mvn (pom.xml) and sbt (build.sbt) produce the same output; for instance :

> make -s run
akka://HelloAkka
>>> Press ENTER to exit <<<

BehaviourAndState Example

Batch file build.bat matches what a user would run from the command prompt (use option -debug to see the execution details):

> build -verbose run
Compile 2 Scala source files to directory "target\classes"
[BehaviourAndState-akka.actor.default-dispatcher-5] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
actor.path=akka://BehaviourAndState/user/summingActor
my state as sum is 2
>>> Press ENTER to exit <<<

[BehaviourAndState-akka.actor.default-dispatcher-5] INFO akka.actor.CoordinatedShutdown - Running CoordinatedShutdown with reason [ActorSystemTerminateReason]

ControlAwareMailbox Example

WIP

CustomMailbox Example

WIP

PriorityMailbox Example

WIP

ActorLifeCycle Example

WIP

ParentChild Example

WIP

Footnotes

[1] Lagom Documentation

From the Lagom 1.6.x documentation :

mics/November 2024