Skip to content

michelou/akka-examples

Repository files navigation

Playing with Akka on Windows

Akka project This repository gathers Akka code examples coming from various websites and books.
It also includes several build scripts (Ant files, bash scripts, batch files, Make scripts) for experimenting with Akka on a Windows machine.

Ada, C++, COBOL, Dart, Deno, Docker, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak, WiX Toolset and Zig are other topics we are continuously investigating.

Read the document "What is Akka?" from the Akka Guide for a quick overview of the Akka toolkit.

Project dependencies

This project depends on the following external software for the Microsoft Windows platform:

Maven packages
We present the Maven package dependencies in document PACKAGES.md.

Optionally one may also install the following software:

🔎 Git for Windows provides a Bash emulation used to run git from the command line (as well as over 250 Unix commands like awk, diff, file, grep, more, mv, rmdir, sed and wc).

For instance our development environment looks as follows (September 2024) 2:

C:\opt\apache-ant\              ( 43 MB)
C:\opt\apache-maven\            ( 10 MB)
C:\opt\ConEmu\                  ( 26 MB)
C:\opt\Git\                     (387 MB)
C:\opt\gradle\                  (135 MB)
C:\opt\grpcurl\                 ( 24 MB)
C:\opt\jdk-temurin-17.0.12_7\   (301 MB)
C:\opt\jdk-temurin-21.0.4_7\    (326 MB)
C:\opt\make-3.81\               (  2 MB)
C:\opt\sbt\                     (110 MB)
C:\opt\scala-2.13.15\           ( 25 MB)
C:\opt\scala3-3.3.4\            ( 38 MB)
C:\opt\VSCode\                  (341 MB)

Installation policy
When possible we install software from a Zip archive rather than via a Windows installer. In our case we defined C:\opt\ as the installation directory for optional software tools (in reference to the /opt/ directory on Unix).

Directory structure

This project is organized as follows:

bin\
alexandreesl-examples\{README.md, akka-stream-lab}
akka\     (Git submodule)
akka-concurrency\{README.md, Avionics, BadSharespearean, etc.}
akka-cookbook\{README.md, HelloAkka, PriorityMailbox, etc.}
akka-essentials\{README.md, FirstAkkaApplication, etc.}
docs\
effective-akka\{README.md, ExtraPattern, etc.>}
examples\{README.md, akka-quickstart-java, akka-quickstart-kotlin, ..}
pekko-examples\{README.md, HelloWorld, etc.>}
PACKAGES.md
README.md
RESOURCES.md
setenv.bat

where

Batch commands

setenv.bat 3

We execute command setenv.bat once to setup our development environment; it makes external tools such as ant.bat, git.exe or sbt.bat directly available from the command prompt.

> setenv
Tool versions:
   javac 17.0.12, scalac 2.13.15, sbt 1.10.2,
   ant 1.10.14, gradle 8.10.1, mvn 3.9.9, grpcurl v1.9.1,
   make 3.81, git 2.46.0, diff 3.10, bash 5.2.26(1)

> where ant git sbt
C:\opt\apache-ant\bin\ant
C:\opt\apache-ant\bin\ant.bat
C:\opt\apache-ant\bin\ant.cmd
C:\opt\Git\bin\git.exe
C:\opt\Git\mingw64\bin\git.exe
C:\opt\sbt\bin\sbt
C:\opt\sbt\bin\sbt.bat

searchjars.bat

Command searchjars.bat prints the list of all JAR files containing a specific class or method name among the locally available libraries. In the following example we search for occurrences of class NotUsed :

> searchjars.bat NotUsed
Warning: Search all directories (no option specified)
Searching for class "NotUsed" in files "C:\opt\scala3-3.3.4\lib\*.jar"
Searching for class "NotUsed" in files "C:\opt\scala-2.13.15\lib\*.jar"
Searching for class "NotUsed" in files "C:\opt\jdk-temurin-17.0.12_7\lib\*.jar"
Searching for class "NotUsed" in files "%USERPROFILE%\.ivy2\cache\*.jar"
  akka-actor_2.13-2.9.2.jar:akka/NotUsed$.class
  akka-actor_2.13-2.9.2.jar:akka/NotUsed.class
Searching for class "NotUsed" in files "%USERPROFILE%\.m2\repository\*.jar"
  akka-actor_2.13-2.9.2.jar:akka/NotUsed$.class
  akka-actor_2.13-2.9.2.jar:akka/NotUsed.class
  akka-stream_2.13-2.8.5.jar:akka/stream/impl/PushNotUsed$.class
  akka-stream_2.13-2.8.5.jar:akka/stream/impl/PushNotUsed.class
  pekko-actor_2.13-1.0.3.jar:org/apache/pekko/NotUsed$.class
  pekko-actor_2.13-1.0.3.jar:org/apache/pekko/NotUsed.class

Footnotes

[1] Gradle Support for Java

Gradle versionJava version
8.1023
8.922
8.7, 8.822
8.4, 8.5, 8.621
8.320
7.6, 8.0 a), 8.1, 8.219
7.518
7.317
7.016
6.715
6.314
6.013
a) Version 8.0.2 or newer is required for use with Scala 2.13 (see issue 23962).

[2] Downloads

In our case we downloaded the following installation files (see section 1):
apache-ant-1.10.14-bin.zip                         (  9 MB)
apache-maven-3.9.9-bin.zip                         ( 10 MB)
ConEmuPack.230724.7z                               (  5 MB)
gradle-8.10.1-bin.zip                              (130 MB)
grpcurl_1.9.1_windows_x86_64.zip                   (  6 MB)
make-3.81-bin.zip                                  ( 10 MB)
OpenJDK17U-jdk_x64_windows_hotspot_17.0.12_7.zip   (188 MB)
OpenJDK21U-jdk_x64_windows_hotspot_21.0.4_7.zip    (191 MB)
PortableGit-2.46.0-64-bit.7z.exe                   ( 47 MB)
sbt-1.10.2.zip                                     ( 45 MB)
scala-2.13.15.zip                                  ( 21 MB)
scala3-3.3.4-RC1.zip                               ( 34 MB)
VSCode-win32-x64-1.93.1.zip                        (131 MB)

[3] setenv.bat usage

Batch file setenv.bat has specific environment variables set that enable us to use command-line developer tools more easily.
It is similar to the setup scripts described on the page "Visual Studio Developer Command Prompt and Developer PowerShell" of the Visual Studio online documentation.
For instance we can quickly check that the two scripts Launch-VsDevShell.ps1 and VsDevCmd.bat are indeed available in our Visual Studio 2019 installation :
> where /r "C:\Program Files (x86)\Microsoft Visual Studio" *vsdev*
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\Launch-VsDevShell.ps1
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_end.bat
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\vsdevcmd\core\vsdevcmd_start.bat
Concretely, in our GitHub projects which depend on Visual Studio (e.g. michelou/cpp-examples), setenv.bat does invoke VsDevCmd.bat (resp. vcvarall.bat for older Visual Studio versions) to setup the Visual Studio tools on the command prompt.

mics/September 2024  

About

Playing with Akka on Windows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published