michelou / akka-examples

Playing with Akka on Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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++, Dart, Deno, Docker, Flix, Golang, GraalVM, Haskell, Kafka, Kotlin, LLVM, Modula-2, Node.js, Rust, Scala 3, Spark, Spring, TruffleSqueak and WiX Toolset are other topics we are continuously investigating.

Apache Pekko is a fork of Akka 2.6.x, prior to the Akka project’s adoption of the Business Source License.

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 (March 2024) 2:

C:\opt\apache-ant\              ( 43 MB)
C:\opt\apache-maven\            ( 10 MB)
C:\opt\Git\                     (367 MB)
C:\opt\gradle\                  (135 MB)
C:\opt\grpcurl\                 ( 22 MB)
C:\opt\jdk-temurin-17.0.10_7\   (301 MB)
C:\opt\jdk-temurin-21.0.2_13\   (326 MB)
C:\opt\make-3.81\               (  2 MB)
C:\opt\sbt\                     (110 MB)
C:\opt\scala-2.13.13\           ( 24 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.10 scalac 2.13.13, sbt 1.9.9,
   ant 1.10.14, gradle 8.6, mvn 3.9.6, grpcurl v1.8.9,
   make 3.81, git 2.44.0.windows.1, diff 3.10, bash 5.2.26(1)-release

> 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 helps us to get the list of all JAR files containing a specific class or method name among the locally available libraries. In the following example we are searching 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.2\lib\*.jar"
Searching for class "NotUsed" in files "C:\opt\scala-2.13.13\lib\*.jar"
Searching for class "NotUsed" in files "C:\opt\jdk-temurin-17.0.10_7\lib\*.jar"
Searching for class "NotUsed" in files "%USERPROFILE%\.ivy2\cache\*.jar"
  akka-actor_2.13-2.8.5.jar:akka/NotUsed$.class
  akka-actor_2.13-2.8.5.jar:akka/NotUsed.class
Searching for class "NotUsed" in files "%USERPROFILE%\.m2\repository\*.jar"
  akka-actor_2.13-2.8.5.jar:akka/NotUsed$.class
  akka-actor_2.13-2.8.5.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.1.jar:org/apache/pekko/NotUsed$.class
  pekko-actor_2.13-1.0.1.jar:org/apache/pekko/NotUsed.class

Footnotes

[1] Gradle Support for Java

Gradle versionJava version
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.6-bin.zip                         ( 10 MB)
gradle-8.6-bin.zip                                 (118 MB)
grpcurl_1.8.9_windows_x86_64.zip                   (  6 MB)
make-3.81-bin.zip                                  ( 10 MB)
OpenJDK17U-jdk_x64_windows_hotspot_17.0.10_7.zip   (188 MB)
OpenJDK21U-jdk_x64_windows_hotspot_21.0.2_13.zip   (191 MB)
PortableGit-2.44.0-64-bit.7z.exe                   ( 47 MB)
sbt-1.9.9.zip                                      ( 17 MB)
scala-2.13.13.zip                                  ( 21 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/March 2024  

About

Playing with Akka on Windows


Languages

Language:Scala 68.9%Language:Java 31.1%