This is an automated email from the ASF dual-hosted git repository.
mdedetrich pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-samples.git
The following commit(s) were added to refs/heads/main by this push:
new 41d770a #243: Convert `sharding` (non-kafka) to pekko (#25)
41d770a is described below
commit 41d770aab910e600f6806f434c1ecd5e4bfa956d
Author: Sam Byng <[email protected]>
AuthorDate: Mon Apr 3 15:29:34 2023 +0100
#243: Convert `sharding` (non-kafka) to pekko (#25)
Co-authored-by: sb5 <[email protected]>
---
.github/workflows/build-test.yml | 8 ++--
docs-gen/build.sbt | 8 ++--
pekko-sample-distributed-workers-scala/README.md | 2 +-
.../.gitignore | 0
.../COPYING | 0
.../LICENSE | 0
.../README.md | 40 ++++++++--------
.../build.sbt | 38 ++++++++-------
.../killrweather-fog/pom.xml | 50 +++++++++++--------
.../main/java/sample/killrweather/fog/Data.java | 0
.../src/main/java/sample/killrweather/fog/Fog.java | 2 +-
.../java/sample/killrweather/fog/FogSettings.java | 2 +-
.../java/sample/killrweather/fog/Guardian.java | 6 +--
.../sample/killrweather/fog/WeatherStation.java | 22 ++++-----
.../src/main/resources/application.conf | 2 +-
.../src/main/resources/logback.xml | 2 +-
.../killrweather/pom.xml | 56 +++++++++++++---------
.../java/sample/killrweather/CborSerializable.java | 0
.../main/java/sample/killrweather/Guardian.java | 4 +-
.../java/sample/killrweather/KillrWeather.java | 12 ++---
.../sample/killrweather/WeatherHttpServer.java | 20 ++++----
.../java/sample/killrweather/WeatherRoutes.java | 26 +++++-----
.../java/sample/killrweather/WeatherStation.java | 26 +++++-----
.../src/main/resources/application.conf | 8 ++--
.../killrweather/src/main/resources/logback.xml | 2 +-
.../pom.xml | 4 +-
.../project/build.properties | 0
.../project/plugins.sbt | 0
.../LICENSE | 0
.../README.md | 40 ++++++++--------
.../build.sbt | 40 +++++++++-------
.../src/main/resources/application.conf | 2 +-
.../src/main/resources/logback.xml | 0
.../main/scala/sample/killrweather/fog/Fog.scala | 10 ++--
.../sample/killrweather/fog/WeatherStation.scala | 20 ++++----
.../src/main/resources/application.conf | 8 ++--
.../killrweather/src/main/resources/logback.xml | 0
.../sample/killrweather/CborSerializable.scala | 0
.../main/scala/sample/killrweather/Guardian.scala | 4 +-
.../sample/killrweather/JacksonSerializers.scala | 0
.../scala/sample/killrweather/JsonFormats.scala | 0
.../scala/sample/killrweather/KillrWeather.scala | 10 ++--
.../sample/killrweather/WeatherHttpServer.scala | 12 ++---
.../scala/sample/killrweather/WeatherRoutes.scala | 18 +++----
.../scala/sample/killrweather/WeatherStation.scala | 20 ++++----
.../project/build.properties | 0
46 files changed, 278 insertions(+), 246 deletions(-)
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 2788f6a..8c7236a 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -62,11 +62,11 @@ jobs:
- name: Test pekko-sample-persistence-dc-scala
run: cd pekko-sample-persistence-dc-scala && sbt test
- - name: Test akka-sample-sharding-java
- run: cd akka-sample-sharding-java && mvn test
+ - name: Test pekko-sample-sharding-java
+ run: cd pekko-sample-sharding-java && mvn test
- - name: Test akka-sample-sharding-scala
- run: cd akka-sample-sharding-scala && sbt test
+ - name: Test pekko-sample-sharding-scala
+ run: cd pekko-sample-sharding-scala && sbt test
- name: Test pekko-sample-kafka-to-sharding-scala
run: cd pekko-sample-kafka-to-sharding-scala && sbt test
diff --git a/docs-gen/build.sbt b/docs-gen/build.sbt
index 9eebd37..2102614 100644
--- a/docs-gen/build.sbt
+++ b/docs-gen/build.sbt
@@ -52,17 +52,17 @@ lazy val `pekko-sample-persistence-scala` = project
name := "Akka Persistence with Scala",
baseProject := "pekko-sample-persistence-scala")
-lazy val `akka-sample-sharding-java` = project
+lazy val `pekko-sample-sharding-java` = project
.enablePlugins(AkkaSamplePlugin)
.settings(
name := "Akka Cluster Sharding with Java",
- baseProject := "akka-sample-sharding-java")
+ baseProject := "pekko-sample-sharding-java")
-lazy val `akka-sample-sharding-scala` = project
+lazy val `pekko-sample-sharding-scala` = project
.enablePlugins(AkkaSamplePlugin)
.settings(
name := "Akka Cluster Sharding with Scala",
- baseProject := "akka-sample-sharding-scala")
+ baseProject := "pekko-sample-sharding-scala")
lazy val `pekko-sample-kafka-to-sharding-scala` = project
.enablePlugins(AkkaSamplePlugin)
diff --git a/pekko-sample-distributed-workers-scala/README.md
b/pekko-sample-distributed-workers-scala/README.md
index e8249e7..8dc1351 100644
--- a/pekko-sample-distributed-workers-scala/README.md
+++ b/pekko-sample-distributed-workers-scala/README.md
@@ -46,7 +46,7 @@ Let's look at the details of each part of the application,
starting with the fro
## Front end
Typically in systems built with Apache Pekko, clients submit requests using a
RESTful API or a gRPC API.
-Either
[PekkoHTTP](http://doc.pekko.io/docs/pekko-http/current/scala/http/introduction.html)
or [Play Framework](https://www.playframework.com)
+Either [Pekko
HTTP](http://doc.pekko.io/docs/pekko-http/current/scala/http/introduction.html)
or [Play Framework](https://www.playframework.com)
are great choices for implementing an HTTP API for the front-end, [Pekko
gRPC](https://doc.pekko.io/docs/pekko-grpc/current/index.html) can be used of
a gRPC front end is preferred.
diff --git a/akka-sample-sharding-java/.gitignore
b/pekko-sample-sharding-java/.gitignore
similarity index 100%
rename from akka-sample-sharding-java/.gitignore
rename to pekko-sample-sharding-java/.gitignore
diff --git a/akka-sample-sharding-java/COPYING
b/pekko-sample-sharding-java/COPYING
similarity index 100%
rename from akka-sample-sharding-java/COPYING
rename to pekko-sample-sharding-java/COPYING
diff --git a/akka-sample-sharding-java/LICENSE
b/pekko-sample-sharding-java/LICENSE
similarity index 100%
rename from akka-sample-sharding-java/LICENSE
rename to pekko-sample-sharding-java/LICENSE
diff --git a/akka-sample-sharding-java/README.md
b/pekko-sample-sharding-java/README.md
similarity index 77%
rename from akka-sample-sharding-java/README.md
rename to pekko-sample-sharding-java/README.md
index a0b7967..d8dbd32 100644
--- a/akka-sample-sharding-java/README.md
+++ b/pekko-sample-sharding-java/README.md
@@ -1,11 +1,11 @@
# Cluster Sharding sample
-The KillrWeather sample illustrates how to use [Akka Cluster
Sharding](https://pekko.apache.org/docs/pekko/current//java/typed/cluster-sharding.html)
in Java, for the same sample in Scala see [Cluster Sharding Sample
Scala](https://github.com/akka/akka-samples/tree/2.6/akka-sample-sharding-scala)
-It also shows the basic usage of [Akka
HTTP](https://doc.akka.io/docs/akka-http/current/index.html).
+The KillrWeather sample illustrates how to use [Apache Pekko Cluster
Sharding](https://pekko.apache.org/docs/pekko/current//java/typed/cluster-sharding.html)
in Java, for the same sample in Scala see [Cluster Sharding Sample
Scala](https://github.com/apache/incubator-pekko-samples/tree/main/pekko-sample-sharding-scala)
+It also shows the basic usage of [Apache Pekko
HTTP](https://pekko.apache.org/docs/pekko-http/current/index.html).
The sample consists of two applications, each a separate maven submodule:
- * *killrweather* - A distributed Akka cluster that shards weather stations,
each keeping a set of recorded
+ * *killrweather* - A distributed Apache Pekko cluster that shards weather
stations, each keeping a set of recorded
data points and allowing for local querying of the records. The cluster app
has a HTTP endpoint for recording
and querying the data per weather station.
@@ -47,13 +47,13 @@ The
[WeatherHttpServer](killrweather/src/main/java/sample/killrweather/WeatherHt
to receive and unmarshall data from remote devices by station ID to allow
querying. To interact with the sharded entities it uses the [`EntityRef`
API](killrweather/src/main/java/sample/killrweather/WeatherRoutes.java#L40).
-The HTTP port of each node is chosen from the port used for Akka Remoting plus
10000, so for a node running
-on port 2525 the HTTP port will be 12525.
+The HTTP port of each node is chosen from the port used for Apache Pekko
Remoting plus 10000, so for a node running
+on port 7355 the HTTP port will be 17355.
### Configuration
This application is configured in
[killrweather/src/main/resources/application.conf](killrweather/src/main/resources/application.conf)
-Before running, first make sure the correct settings are set for your system,
as described in the akka-sample-cluster tutorial.
+Before running, first make sure the correct settings are set for your system,
as described in the pekko-sample-cluster tutorial.
## Fog Network
@@ -71,9 +71,9 @@ upon boot.
### Weather stations and devices
Each
[WeatherStation](killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java)
is run on a task to trigger scheduled data sampling.
-These samples are timestamped and sent to the cluster over HTTP using [Akka
HTTP](https://doc.akka.io/docs/akka-http/current/index.html).
+These samples are timestamped and sent to the cluster over HTTP using [Apache
Pekko HTTP](https://pekko.apache.org/docs/pekko-http/current/index.html).
-## Akka HTTP example
+## Apache Pekko HTTP example
Within KillrWeather are two simple sides to an HTTP equation.
@@ -109,9 +109,9 @@ In the log snippet below, note the dynamic weather ports
opened by each KillrWea
The number of ports are by default three, for the minimum three node cluster.
You can start more cluster nodes, so these are dynamic to avoid bind errors.
```
-[2020-01-16 13:44:58,842] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:12553/
-[2020-01-16 13:44:58,842] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-19] [] - WeatherServer online at
http://127.0.0.1:53937/
-[2020-01-16 13:44:58,843] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-15] [] - WeatherServer online at
http://127.0.0.1:12554/
+[2020-01-16 13:44:58,842] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:17345/
+[2020-01-16 13:44:58,842] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-19] [] - WeatherServer online at
http://127.0.0.1:53937/
+[2020-01-16 13:44:58,843] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-15] [] - WeatherServer online at
http://127.0.0.1:17355/
```
#### A three node cluster in separate JVMs
@@ -119,19 +119,19 @@ The number of ports are by default three, for the minimum
three node cluster. Yo
It is more interesting to run them in separate processes. Stop the application
and then open three terminal windows.
In the first terminal window, start the first seed node with the following
command:
- mvn -pl killrweather exec:java -Dexec.args="2553"
+ mvn -pl killrweather exec:java -Dexec.args="7345"
-2553 corresponds to the port of the first seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and changed status to 'Up'.
+7345 corresponds to the port of the first seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and changed status to 'Up'.
You'll see a log message when a `WeatherStation` sends a message to record the
current temperature, and for each of those you'll see a log message from the
`WeatherRoutes` showing the action taken and the new average temperature.
In the second terminal window, start the second seed node with the following
command:
- mvn -pl killrweather exec:java -Dexec.args="2554"
+ mvn -pl killrweather exec:java -Dexec.args="7355"
-2554 corresponds to the port of the second seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and joins the other seed node and becomes a member of the cluster. Its status
changed to 'Up'. Switch over to the first terminal window and see in the log
output that the member joined.
+7355 corresponds to the port of the second seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and joins the other seed node and becomes a member of the cluster. Its status
changed to 'Up'. Switch over to the first terminal window and see in the log
output that the member joined.
-Some of the temperature aggregators that were originally on the `ActorSystem`
on port 2553 will be migrated to the newly joined `ActorSystem` on port 2554.
The migration is straightforward: the old actor is stopped and a fresh actor is
started on the newly created `ActorSystem`. Notice this means the average is
reset: if you want your state to be persisted you'll need to take care of this
yourself. For this reason Cluster Sharding and Akka Persistence are such a
popular combination.
+Some of the temperature aggregators that were originally on the `ActorSystem`
on port 7345 will be migrated to the newly joined `ActorSystem` on port 7355.
The migration is straightforward: the old actor is stopped and a fresh actor is
started on the newly created `ActorSystem`. Notice this means the average is
reset: if you want your state to be persisted you'll need to take care of this
yourself. For this reason Cluster Sharding and Apache Pekko Persistence are
such a popular combination.
Start another node in the third terminal window with the following command:
@@ -146,7 +146,7 @@ Start even more nodes in the same way, if you like.
Each node's log will show its dynamic weather port opened for weather stations
to connect to.
```
-[2020-01-16 13:44:58,842] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:12553/
+[2020-01-16 13:44:58,842] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:17345/
```
@@ -157,13 +157,13 @@ With the cluster running you can interact with the HTTP
endpoint using raw HTTP,
Record data for station 62:
```
-curl -XPOST http://localhost:12553/weather/62 -H "Content-Type:
application/json" --data '{"eventTime": 1579106781, "dataType": "temperature",
"value": 10.3}'
+curl -XPOST http://localhost:17345/weather/62 -H "Content-Type:
application/json" --data '{"eventTime": 1579106781, "dataType": "temperature",
"value": 10.3}'
```
Query average temperature for station 62:
```
-curl "http://localhost:12553/weather/62?type=temperature&function=average"
+curl "http://localhost:17345/weather/62?type=temperature&function=average"
```
### The Fog Network
@@ -177,7 +177,7 @@ If you have started cluster nodes manually providing port
numbers you will have
For example:
- mvn -pl killrweather exec:java -Dexec.args="2553"
+ mvn -pl killrweather exec:java -Dexec.args="7345"
sbt "killrweather-fog/runMain sample.killrweather.fog.Fog 8081 8033 8056"
### Shutting down
diff --git a/akka-sample-sharding-java/build.sbt
b/pekko-sample-sharding-java/build.sbt
similarity index 53%
rename from akka-sample-sharding-java/build.sbt
rename to pekko-sample-sharding-java/build.sbt
index 55aaf8b..1f1ba31 100644
--- a/akka-sample-sharding-java/build.sbt
+++ b/pekko-sample-sharding-java/build.sbt
@@ -1,10 +1,12 @@
-val AkkaVersion = "2.6.20"
-val AkkaHttpVersion = "10.2.10"
+val pekkoVersion = "0.0.0+26623-85c2a469-SNAPSHOT"
+val pekkoHttpVersion = "0.0.0+4335-81a9800e-SNAPSHOT"
val LogbackVersion = "1.2.11"
lazy val buildSettings = Seq(
- organization := "com.lightbend.akka.samples",
- scalaVersion := "2.13.8")
+ organization := "org.apache.pekko",
+ scalaVersion := "2.13.8",
+ // allow access to snapshots
+ resolvers += "Apache Nexus
Snapshots".at("https://repository.apache.org/content/groups/snapshots/"))
lazy val commonJavacOptions = Seq(
"-Xlint:unchecked",
@@ -20,32 +22,34 @@ lazy val commonSettings = Seq(
lazy val killrweather = project
.in(file("killrweather"))
+ .settings(buildSettings)
.settings(commonSettings)
.settings(
Compile / run / mainClass := Some("sample.killrweather.KillrWeather"),
libraryDependencies ++= Seq(
- "com.typesafe.akka" %% "akka-cluster-sharding-typed" % AkkaVersion,
- "com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion,
- "com.typesafe.akka" %% "akka-distributed-data" % AkkaVersion,
- "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion,
- "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
- "com.typesafe.akka" %% "akka-http-jackson" % AkkaHttpVersion,
+ "org.apache.pekko" %% "pekko-cluster-sharding-typed" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-distributed-data" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
+ "org.apache.pekko" %% "pekko-http-jackson" % pekkoHttpVersion,
"ch.qos.logback" % "logback-classic" % LogbackVersion))
lazy val `killrweather-fog` = project
.in(file("killrweather-fog"))
+ .settings(buildSettings)
.settings(commonSettings)
.settings(
Compile / run / mainClass := Some("sample.killrweather.fog.Fog"),
libraryDependencies ++= Seq(
- "com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion,
- "com.typesafe.akka" %% "akka-stream-typed" % AkkaVersion,
- "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
- "com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion,
- "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion,
+ "org.apache.pekko" %% "pekko-actor-typed" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-stream-typed" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
+ "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion,
"ch.qos.logback" % "logback-classic" % LogbackVersion))
// Startup aliases for the first two seed nodes and a third, more can be
started.
-addCommandAlias("sharding1", "runMain sample.killrweather.KillrWeather 2551")
-addCommandAlias("sharding2", "runMain sample.killrweather.KillrWeather 2552")
+addCommandAlias("sharding1", "runMain sample.killrweather.KillrWeather 7345")
+addCommandAlias("sharding2", "runMain sample.killrweather.KillrWeather 7355")
addCommandAlias("sharding3", "runMain sample.killrweather.KillrWeather 0")
diff --git a/akka-sample-sharding-java/killrweather-fog/pom.xml
b/pekko-sample-sharding-java/killrweather-fog/pom.xml
similarity index 59%
rename from akka-sample-sharding-java/killrweather-fog/pom.xml
rename to pekko-sample-sharding-java/killrweather-fog/pom.xml
index 2922a15..4493359 100644
--- a/akka-sample-sharding-java/killrweather-fog/pom.xml
+++ b/pekko-sample-sharding-java/killrweather-fog/pom.xml
@@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>akka-sample-sharding-killrweather-fog-java</artifactId>
- <groupId>com.lightbend.akka.samples</groupId>
+ <artifactId>pekko-sample-sharding-killrweather-fog-java</artifactId>
+ <groupId>org.apache.pekko</groupId>
<name>Killrweather Fog</name>
<version>1.0-SNAPSHOT</version>
@@ -18,35 +18,47 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <akka.version>2.6.20</akka.version>
- <akka-http.version>10.1.11</akka-http.version>
+ <pekko.version>0.0.0+26623-85c2a469-SNAPSHOT</pekko.version>
+ <pekko-http.version>0.0.0+4335-81a9800e-SNAPSHOT</pekko-http.version>
</properties>
+ <repositories>
+ <repository>
+ <id>apache-pekko-snapshots</id>
+ <name>Apache Snapshots Repository</name>
+
<url>https://repository.apache.org/content/repositories/snapshots/</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-actor-typed_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-actor-typed_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-stream-typed_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-stream-typed_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-serialization-jackson_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-serialization-jackson_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-http_2.13</artifactId>
- <version>${akka-http.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-http_2.13</artifactId>
+ <version>${pekko-http.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-http-jackson_2.13</artifactId>
- <version>${akka-http.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-http-jackson_2.13</artifactId>
+ <version>${pekko-http.version}</version>
</dependency>
<dependency>
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Data.java
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Data.java
similarity index 100%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Data.java
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Data.java
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java
similarity index 93%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java
index df2cd78..8e76b3e 100644
---
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java
+++
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Fog.java
@@ -1,6 +1,6 @@
package sample.killrweather.fog;
-import akka.actor.typed.ActorSystem;
+import org.apache.pekko.actor.typed.ActorSystem;
import java.util.Arrays;
import java.util.List;
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/FogSettings.java
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/FogSettings.java
similarity index 94%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/FogSettings.java
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/FogSettings.java
index 98796f5..7bafa13 100644
---
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/FogSettings.java
+++
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/FogSettings.java
@@ -1,6 +1,6 @@
package sample.killrweather.fog;
-import akka.actor.typed.ActorSystem;
+import org.apache.pekko.actor.typed.ActorSystem;
import com.typesafe.config.Config;
import java.time.Duration;
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Guardian.java
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Guardian.java
similarity index 85%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Guardian.java
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Guardian.java
index 9d02500..e14370f 100644
---
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Guardian.java
+++
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/Guardian.java
@@ -1,8 +1,8 @@
package sample.killrweather.fog;
-import akka.actor.typed.Behavior;
-import akka.actor.typed.SupervisorStrategy;
-import akka.actor.typed.javadsl.Behaviors;
+import org.apache.pekko.actor.typed.Behavior;
+import org.apache.pekko.actor.typed.SupervisorStrategy;
+import org.apache.pekko.actor.typed.javadsl.Behaviors;
import java.time.Duration;
import java.util.List;
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java
similarity index 85%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java
index 4209680..9f913af 100644
---
a/akka-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java
+++
b/pekko-sample-sharding-java/killrweather-fog/src/main/java/sample/killrweather/fog/WeatherStation.java
@@ -1,15 +1,15 @@
package sample.killrweather.fog;
-import akka.actor.typed.Behavior;
-import akka.actor.typed.javadsl.*;
-import akka.http.javadsl.Http;
-import akka.http.javadsl.model.ContentTypes;
-import akka.http.javadsl.model.HttpRequest;
-import akka.http.javadsl.model.StatusCode;
-import akka.http.javadsl.model.StatusCodes;
-import akka.http.javadsl.unmarshalling.Unmarshaller;
-import akka.serialization.jackson.JacksonObjectMapperProvider;
-import akka.stream.SystemMaterializer;
+import org.apache.pekko.actor.typed.Behavior;
+import org.apache.pekko.actor.typed.javadsl.*;
+import org.apache.pekko.http.javadsl.Http;
+import org.apache.pekko.http.javadsl.model.ContentTypes;
+import org.apache.pekko.http.javadsl.model.HttpRequest;
+import org.apache.pekko.http.javadsl.model.StatusCode;
+import org.apache.pekko.http.javadsl.model.StatusCodes;
+import org.apache.pekko.http.javadsl.unmarshalling.Unmarshaller;
+import org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider;
+import org.apache.pekko.stream.SystemMaterializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.Optional;
@@ -93,7 +93,7 @@ public class WeatherStation extends
AbstractBehavior<WeatherStation.Command> {
private void recordTemperature(long eventTime, double value) throws
Exception {
Data data = new Data(eventTime, "temperature", value);
- // FIXME no Java API in Akka HTTP to do this using the marshalling infra,
see akka-http#2128
+ // FIXME no Java API in Apache Pekko HTTP to do this using the marshalling
infra, see pekko-http#2128
String json = objectMapper.writeValueAsString(data);
CompletionStage<String> futureResponseBody =
http.singleRequest(HttpRequest.POST(stationUrl).withEntity(ContentTypes.APPLICATION_JSON,
json))
diff --git
a/akka-sample-sharding-scala/killrweather-fog/src/main/resources/application.conf
b/pekko-sample-sharding-java/killrweather-fog/src/main/resources/application.conf
similarity index 94%
rename from
akka-sample-sharding-scala/killrweather-fog/src/main/resources/application.conf
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/resources/application.conf
index 1dc0048..5492175 100644
---
a/akka-sample-sharding-scala/killrweather-fog/src/main/resources/application.conf
+++
b/pekko-sample-sharding-java/killrweather-fog/src/main/resources/application.conf
@@ -2,7 +2,7 @@
# KillrWeather weather station and device config
######################################################
-akka.loglevel = DEBUG
+pekko.loglevel = DEBUG
killrweather.fog {
# Initial number of weather stations
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/resources/logback.xml
b/pekko-sample-sharding-java/killrweather-fog/src/main/resources/logback.xml
similarity index 94%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/resources/logback.xml
rename to
pekko-sample-sharding-java/killrweather-fog/src/main/resources/logback.xml
index da90195..c50f67f 100644
--- a/akka-sample-sharding-java/killrweather-fog/src/main/resources/logback.xml
+++ b/pekko-sample-sharding-java/killrweather-fog/src/main/resources/logback.xml
@@ -7,7 +7,7 @@
logging config, see the Apache Pekko docs:
https://pekko.apache.org/docs/pekko/current/typed/logging.html#logback -->
<appender name="STDOUT" target="System.out"
class="ch.qos.logback.core.ConsoleAppender">
<encoder>
- <pattern>[%date{ISO8601}] [%level] [%logger] [%thread]
[%X{akkaSource}] - %msg%n</pattern>
+ <pattern>[%date{ISO8601}] [%level] [%logger] [%thread]
[%X{pekkoSource}] - %msg%n</pattern>
</encoder>
</appender>
diff --git a/akka-sample-sharding-java/killrweather/pom.xml
b/pekko-sample-sharding-java/killrweather/pom.xml
similarity index 57%
rename from akka-sample-sharding-java/killrweather/pom.xml
rename to pekko-sample-sharding-java/killrweather/pom.xml
index 5787eb9..018b260 100644
--- a/akka-sample-sharding-java/killrweather/pom.xml
+++ b/pekko-sample-sharding-java/killrweather/pom.xml
@@ -4,8 +4,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <artifactId>akka-sample-sharding-killrweather-java</artifactId>
- <groupId>com.lightbend.akka.samples</groupId>
+ <artifactId>pekko-sample-sharding-killrweather-java</artifactId>
+ <groupId>org.apache.pekko</groupId>
<name>Killrweather</name>
<version>1.0-SNAPSHOT</version>
@@ -18,40 +18,52 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <akka.version>2.6.20</akka.version>
- <akka-http.version>10.1.11</akka-http.version>
+ <pekko.version>0.0.0+26623-85c2a469-SNAPSHOT</pekko.version>
+ <pekko-http.version>0.0.0+4335-81a9800e-SNAPSHOT</pekko-http.version>
</properties>
+ <repositories>
+ <repository>
+ <id>apache-pekko-snapshots</id>
+ <name>Apache Snapshots Repository</name>
+
<url>https://repository.apache.org/content/repositories/snapshots/</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-actor-typed_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-actor-typed_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-cluster-typed_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-cluster-typed_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-cluster-sharding-typed_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-cluster-sharding-typed_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-serialization-jackson_2.13</artifactId>
- <version>${akka.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-serialization-jackson_2.13</artifactId>
+ <version>${pekko.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-http_2.13</artifactId>
- <version>${akka-http.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-http_2.13</artifactId>
+ <version>${pekko-http.version}</version>
</dependency>
<dependency>
- <groupId>com.typesafe.akka</groupId>
- <artifactId>akka-http-jackson_2.13</artifactId>
- <version>${akka-http.version}</version>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-http-jackson_2.13</artifactId>
+ <version>${pekko-http.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
diff --git
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/CborSerializable.java
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/CborSerializable.java
similarity index 100%
rename from
akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/CborSerializable.java
rename to
pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/CborSerializable.java
diff --git
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/Guardian.java
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/Guardian.java
similarity index 81%
rename from
akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/Guardian.java
rename to
pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/Guardian.java
index 3d087da..897a973 100644
---
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/Guardian.java
+++
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/Guardian.java
@@ -1,7 +1,7 @@
package sample.killrweather;
-import akka.actor.typed.Behavior;
-import akka.actor.typed.javadsl.Behaviors;
+import org.apache.pekko.actor.typed.Behavior;
+import org.apache.pekko.actor.typed.javadsl.Behaviors;
/**
* Root actor bootstrapping the application
diff --git
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java
similarity index 82%
rename from
akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java
rename to
pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java
index f12dc0a..9e930b6 100644
---
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java
+++
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/KillrWeather.java
@@ -1,7 +1,7 @@
package sample.killrweather;
-import akka.actor.AddressFromURIString;
-import akka.actor.typed.ActorSystem;
+import org.apache.pekko.actor.AddressFromURIString;
+import org.apache.pekko.actor.typed.ActorSystem;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
@@ -19,10 +19,10 @@ public class KillrWeather {
public static void main(String[] args) throws Exception {
List<Integer> seedNodePorts =
- ConfigFactory.load().getStringList("akka.cluster.seed-nodes")
+ ConfigFactory.load().getStringList("pekko.cluster.seed-nodes")
.stream()
.map(AddressFromURIString::parse)
- .map(addr -> (Integer) addr.port().get()) // Missing Java getter for
port, fixed in Akka 2.6.2
+ .map(addr -> (Integer) addr.port().get()) // Missing Java getter for
port
.collect(Collectors.toList());
// Either use a single port provided by the user
@@ -40,7 +40,7 @@ public class KillrWeather {
for (int port : ports) {
final int httpPort;
- if (port > 0) httpPort = 10000 + port; // offset from akka port
+ if (port > 0) httpPort = 10000 + port; // offset from pekko port
else httpPort = 0; // let OS decide
Config config = configWithPort(port);
@@ -50,7 +50,7 @@ public class KillrWeather {
private static Config configWithPort(int port) {
return ConfigFactory.parseMap(
- Collections.singletonMap("akka.remote.artery.canonical.port",
Integer.toString(port))
+ Collections.singletonMap("pekko.remote.artery.canonical.port",
Integer.toString(port))
).withFallback(ConfigFactory.load());
}
diff --git
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherHttpServer.java
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherHttpServer.java
similarity index 73%
rename from
akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherHttpServer.java
rename to
pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherHttpServer.java
index 62675d0..a186c87 100644
---
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherHttpServer.java
+++
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherHttpServer.java
@@ -1,23 +1,23 @@
package sample.killrweather;
-import akka.actor.CoordinatedShutdown;
-import akka.actor.typed.ActorSystem;
-import akka.actor.typed.javadsl.Adapter;
-import akka.http.javadsl.ConnectHttp;
-import akka.http.javadsl.Http;
-import akka.http.javadsl.server.Route;
-import akka.stream.Materializer;
-import akka.stream.SystemMaterializer;
+import org.apache.pekko.actor.CoordinatedShutdown;
+import org.apache.pekko.actor.typed.ActorSystem;
+import org.apache.pekko.actor.typed.javadsl.Adapter;
+import org.apache.pekko.http.javadsl.ConnectHttp;
+import org.apache.pekko.http.javadsl.Http;
+import org.apache.pekko.http.javadsl.server.Route;
+import org.apache.pekko.stream.Materializer;
+import org.apache.pekko.stream.SystemMaterializer;
import java.net.InetSocketAddress;
import java.time.Duration;
-import static akka.Done.done;
+import static org.apache.pekko.Done.done;
final class WeatherHttpServer {
public static void start(Route routes, int port, ActorSystem<?> system) {
- akka.actor.ActorSystem classicActorSystem = Adapter.toClassic(system);
+ org.apache.pekko.actor.ActorSystem classicActorSystem =
Adapter.toClassic(system);
Materializer materializer = SystemMaterializer.get(system).materializer();
diff --git
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherRoutes.java
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherRoutes.java
similarity index 79%
rename from
akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherRoutes.java
rename to
pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherRoutes.java
index 41bc481..4e4b6c6 100644
---
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherRoutes.java
+++
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherRoutes.java
@@ -1,19 +1,19 @@
package sample.killrweather;
-import akka.actor.typed.ActorSystem;
-import akka.cluster.sharding.typed.javadsl.ClusterSharding;
-import akka.cluster.sharding.typed.javadsl.EntityRef;
-import akka.http.javadsl.marshallers.jackson.Jackson;
-import akka.http.javadsl.model.HttpEntity;
-import akka.http.javadsl.model.StatusCodes;
-import akka.http.javadsl.server.ExceptionHandler;
-import akka.http.javadsl.server.Route;
-import akka.http.javadsl.unmarshalling.Unmarshaller;
-import akka.serialization.jackson.JacksonObjectMapperProvider;
+import org.apache.pekko.actor.typed.ActorSystem;
+import org.apache.pekko.cluster.sharding.typed.javadsl.ClusterSharding;
+import org.apache.pekko.cluster.sharding.typed.javadsl.EntityRef;
+import org.apache.pekko.http.javadsl.marshallers.jackson.Jackson;
+import org.apache.pekko.http.javadsl.model.HttpEntity;
+import org.apache.pekko.http.javadsl.model.StatusCodes;
+import org.apache.pekko.http.javadsl.server.ExceptionHandler;
+import org.apache.pekko.http.javadsl.server.Route;
+import org.apache.pekko.http.javadsl.unmarshalling.Unmarshaller;
+import org.apache.pekko.serialization.jackson.JacksonObjectMapperProvider;
import com.fasterxml.jackson.databind.ObjectMapper;
-import static akka.http.javadsl.server.Directives.*;
-import static akka.http.javadsl.server.PathMatchers.*;
+import static org.apache.pekko.http.javadsl.server.Directives.*;
+import static org.apache.pekko.http.javadsl.server.PathMatchers.*;
import java.time.Duration;
@@ -30,7 +30,7 @@ public class WeatherRoutes {
public WeatherRoutes(ActorSystem<?> system) {
sharding = ClusterSharding.get(system);
timeout =
system.settings().config().getDuration("killrweather.routes.ask-timeout");
- // use a pre-configured object mapper from akka-jackson also for HTTP JSON
+ // use a pre-configured object mapper from pekko-jackson also for HTTP JSON
// this lets us use the -parameters compiler argument to skip annotating
field names on immutable classes
objectMapper =
JacksonObjectMapperProvider.get(system).getOrCreate("jackson-json",
Optional.empty());
dataUnmarshaller = Jackson.unmarshaller(objectMapper,
WeatherStation.Data.class);
diff --git
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java
similarity index 90%
rename from
akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java
rename to
pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java
index d770e44..015d8a4 100644
---
a/akka-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java
+++
b/pekko-sample-sharding-java/killrweather/src/main/java/sample/killrweather/WeatherStation.java
@@ -1,16 +1,16 @@
package sample.killrweather;
-import akka.actor.typed.ActorRef;
-import akka.actor.typed.ActorSystem;
-import akka.actor.typed.Behavior;
-import akka.actor.typed.PostStop;
-import akka.actor.typed.javadsl.AbstractBehavior;
-import akka.actor.typed.javadsl.ActorContext;
-import akka.actor.typed.javadsl.Behaviors;
-import akka.actor.typed.javadsl.Receive;
-import akka.cluster.sharding.typed.javadsl.ClusterSharding;
-import akka.cluster.sharding.typed.javadsl.Entity;
-import akka.cluster.sharding.typed.javadsl.EntityTypeKey;
+import org.apache.pekko.actor.typed.ActorRef;
+import org.apache.pekko.actor.typed.ActorSystem;
+import org.apache.pekko.actor.typed.Behavior;
+import org.apache.pekko.actor.typed.PostStop;
+import org.apache.pekko.actor.typed.javadsl.AbstractBehavior;
+import org.apache.pekko.actor.typed.javadsl.ActorContext;
+import org.apache.pekko.actor.typed.javadsl.Behaviors;
+import org.apache.pekko.actor.typed.javadsl.Receive;
+import org.apache.pekko.cluster.sharding.typed.javadsl.ClusterSharding;
+import org.apache.pekko.cluster.sharding.typed.javadsl.Entity;
+import org.apache.pekko.cluster.sharding.typed.javadsl.EntityTypeKey;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
@@ -22,14 +22,14 @@ import java.util.stream.Collectors;
* For each weather station common cumulative computations can be run:
* aggregate, averages, high/low, topK (e.g. the top N highest temperatures).
*
- * Note that since this station is not storing its state anywhere else than in
JVM memory, if Akka Cluster Sharding
+ * Note that since this station is not storing its state anywhere else than in
JVM memory, if Apache Pekko Cluster Sharding
* rebalances it - moves it to another node because of cluster nodes added
removed etc - it will lose all its state.
* For a sharded entity to have state that survives being stopped and started
again it needs to be persistent,
* for example by being an EventSourcedBehavior.
*/
final class WeatherStation extends AbstractBehavior<WeatherStation.Command> {
- // setup for using WeatherStations through Akka Cluster Sharding
+ // setup for using WeatherStations through Apache Pekko Cluster Sharding
// these could also live elsewhere and the WeatherStation class be completely
// oblivious to being used in sharding
public static final EntityTypeKey<Command> TypeKey =
diff --git
a/akka-sample-sharding-java/killrweather/src/main/resources/application.conf
b/pekko-sample-sharding-java/killrweather/src/main/resources/application.conf
similarity index 78%
rename from
akka-sample-sharding-java/killrweather/src/main/resources/application.conf
rename to
pekko-sample-sharding-java/killrweather/src/main/resources/application.conf
index f10aa16..a1f2597 100644
--- a/akka-sample-sharding-java/killrweather/src/main/resources/application.conf
+++
b/pekko-sample-sharding-java/killrweather/src/main/resources/application.conf
@@ -2,7 +2,7 @@
# KillrWeather cluster config
######################################################
-akka {
+pekko {
loglevel = DEBUG
actor {
@@ -22,14 +22,14 @@ akka {
cluster {
seed-nodes = [
- "akka://[email protected]:2553",
- "akka://[email protected]:2554"]
+ "pekko://[email protected]:7345",
+ "pekko://[email protected]:7355"]
sharding {
number-of-shards = 100
}
- downing-provider-class = "akka.cluster.sbr.SplitBrainResolverProvider"
+ downing-provider-class = "pekko.cluster.sbr.SplitBrainResolverProvider"
}
}
diff --git
a/akka-sample-sharding-java/killrweather/src/main/resources/logback.xml
b/pekko-sample-sharding-java/killrweather/src/main/resources/logback.xml
similarity index 88%
rename from
akka-sample-sharding-java/killrweather/src/main/resources/logback.xml
rename to pekko-sample-sharding-java/killrweather/src/main/resources/logback.xml
index c4d9ab6..00dd8ac 100644
--- a/akka-sample-sharding-java/killrweather/src/main/resources/logback.xml
+++ b/pekko-sample-sharding-java/killrweather/src/main/resources/logback.xml
@@ -7,7 +7,7 @@
logging config, see the Apache Pekko docs:
https://pekko.apache.org/docs/pekko/current/typed/logging.html#logback -->
<appender name="STDOUT" target="System.out"
class="ch.qos.logback.core.ConsoleAppender">
<encoder>
- <pattern>[%date{ISO8601}] [%level] [%X{akkaAddress}] [%logger]
[%thread] [%X{akkaSource}] - %msg%n</pattern>
+ <pattern>[%date{ISO8601}] [%level] [%X{pekkoAddress}] [%logger]
[%thread] [%X{pekkoSource}] - %msg%n</pattern>
</encoder>
</appender>
diff --git a/akka-sample-sharding-java/pom.xml
b/pekko-sample-sharding-java/pom.xml
similarity index 82%
rename from akka-sample-sharding-java/pom.xml
rename to pekko-sample-sharding-java/pom.xml
index b2b30a4..9f66e23 100644
--- a/akka-sample-sharding-java/pom.xml
+++ b/pekko-sample-sharding-java/pom.xml
@@ -3,8 +3,8 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>com.lightbend.akka.samples</groupId>
- <artifactId>akka-sample-sharding</artifactId>
+ <groupId>org.apache.pekko</groupId>
+ <artifactId>pekko-sample-sharding</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
diff --git a/akka-sample-sharding-java/project/build.properties
b/pekko-sample-sharding-java/project/build.properties
similarity index 100%
rename from akka-sample-sharding-java/project/build.properties
rename to pekko-sample-sharding-java/project/build.properties
diff --git a/akka-sample-sharding-java/project/plugins.sbt
b/pekko-sample-sharding-java/project/plugins.sbt
similarity index 100%
rename from akka-sample-sharding-java/project/plugins.sbt
rename to pekko-sample-sharding-java/project/plugins.sbt
diff --git a/akka-sample-sharding-scala/LICENSE
b/pekko-sample-sharding-scala/LICENSE
similarity index 100%
rename from akka-sample-sharding-scala/LICENSE
rename to pekko-sample-sharding-scala/LICENSE
diff --git a/akka-sample-sharding-scala/README.md
b/pekko-sample-sharding-scala/README.md
similarity index 77%
rename from akka-sample-sharding-scala/README.md
rename to pekko-sample-sharding-scala/README.md
index 6f528eb..f69f940 100644
--- a/akka-sample-sharding-scala/README.md
+++ b/pekko-sample-sharding-scala/README.md
@@ -1,11 +1,11 @@
# Cluster Sharding sample
-The KillrWeather sample illustrates how to use [Pekko Cluster
Sharding](https://pekko.apache.org/docs/pekko/current/scala/typed/cluster-sharding.html)
in Scala, for the same sample in Java see [Cluster Sharding Sample
Java](https://github.com/akka/akka-samples/tree/2.6/akka-sample-sharding-java).
-It also shows the basic usage of [Akka
HTTP](https://doc.akka.io/docs/akka-http/current/index.html).
+The KillrWeather sample illustrates how to use [Pekko Cluster
Sharding](https://pekko.apache.org/docs/pekko/current/scala/typed/cluster-sharding.html)
in Scala, for the same sample in Java see [Cluster Sharding Sample
Java](https://github.com/apache/incubator-pekko-samples/tree/main/pekko-sample-sharding-java).
+It also shows the basic usage of [Pekko
HTTP](http://doc.pekko.io/docs/pekko-http/current/scala/http/introduction.html).
The sample consists of two applications, each a separate maven submodule:
- * *killrweather* - A distributed Akka cluster that shards weather stations,
each keeping a set of recorded
+ * *killrweather* - A distributed Apache Pekko cluster that shards weather
stations, each keeping a set of recorded
data points and allowing for local querying of the records. The cluster
app has a HTTP endpoint for recording
and querying the data per weather station.
@@ -42,15 +42,15 @@ It receives that data stream from remote devices via the
HTTP endpoint. Each `We
The
[WeatherHttpServer](killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala)
is started with
[WeatherRoutes](killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala)
to receive and unmarshall data from remote devices by station ID to allow
- querying. The HTTP port of each node is chosen from the port used for Akka
Remoting plus 10000, so for a node running querying. To
interact with the sharded entities it uses the [`EntityRef`
API](killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala#L26).
+ querying. The HTTP port of each node is chosen from the port used for Apache
Pekko Remoting plus 10000, so for a node running querying. To
interact with the sharded entities it uses the [`EntityRef`
API](killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala#L26).
-The HTTP port of each node is chosen from the port used for Akka Remoting plus
10000, so for a node running
-on port 2525 the HTTP port will be 12525.
+The HTTP port of each node is chosen from the port used for Apache Pekko
Remoting plus 10000, so for a node running
+on port 7355 the HTTP port will be 17355.
### Configuration
This application is configured in
[killrweather/src/main/resources/application.conf](killrweather/src/main/resources/application.conf)
-Before running, first make sure the correct settings are set for your system,
as described in the akka-sample-cluster tutorial.
+Before running, first make sure the correct settings are set for your system,
as described in the pekko-sample-cluster tutorial.
## Fog Network
@@ -68,9 +68,9 @@ upon boot.
### Weather stations and devices
Each
[WeatherStation](killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala)
is run on a task to trigger scheduled data sampling.
-These samples are timestamped and sent to the cluster over HTTP using [Akka
HTTP](https://doc.akka.io/docs/akka-http/current/index.html).
+These samples are timestamped and sent to the cluster over HTTP using [Apache
Pekko
HTTP](http://doc.pekko.io/docs/pekko-http/current/scala/http/introduction.html).
-## Akka HTTP example
+## Apache Pekko HTTP example
Within KillrWeather are two simple sides to an HTTP equation.
@@ -106,9 +106,9 @@ In the log snippet below, note the dynamic weather ports
opened by each KillrWea
The number of ports are by default three, for the minimum three node cluster.
You can start more cluster nodes, so these are dynamic to avoid bind errors.
```
-[2020-01-16 13:44:58,842] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:12553/
-[2020-01-16 13:44:58,842] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-19] [] - WeatherServer online at
http://127.0.0.1:53937/
-[2020-01-16 13:44:58,843] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-15] [] - WeatherServer online at
http://127.0.0.1:12554/
+[2020-01-16 13:44:58,842] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:17345/
+[2020-01-16 13:44:58,842] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-19] [] - WeatherServer online at
http://127.0.0.1:53937/
+[2020-01-16 13:44:58,843] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-15] [] - WeatherServer online at
http://127.0.0.1:17355/
```
#### A three node cluster in separate JVMs
@@ -116,19 +116,19 @@ The number of ports are by default three, for the minimum
three node cluster. Yo
It is more interesting to run them in separate processes. Stop the application
and then open three terminal windows.
In the first terminal window, start the first seed node with the following
command:
- sbt "killrweather/runMain sample.killrweather.KillrWeather 2553"
+ sbt "killrweather/runMain sample.killrweather.KillrWeather 7345"
-2553 corresponds to the port of the first seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and changed status to 'Up'.
+7345 corresponds to the port of the first seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and changed status to 'Up'.
You'll see a log message when a `WeatherStation` sends a message to record the
current temperature, and for each of those you'll see a log message from the
`WeatherRoutes` showing the action taken and the new average temperature.
In the second terminal window, start the second seed node with the following
command:
- sbt "killrweather/runMain sample.killrweather.KillrWeather 2554"
+ sbt "killrweather/runMain sample.killrweather.KillrWeather 7355"
-2554 corresponds to the port of the second seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and joins the other seed node and becomes a member of the cluster. Its status
changed to 'Up'. Switch over to the first terminal window and see in the log
output that the member joined.
+7355 corresponds to the port of the second seed-nodes element in the
configuration. In the log output you see that the cluster node has been started
and joins the other seed node and becomes a member of the cluster. Its status
changed to 'Up'. Switch over to the first terminal window and see in the log
output that the member joined.
-Some of the temperature aggregators that were originally on the `ActorSystem`
on port 2553 will be migrated to the newly joined `ActorSystem` on port 2554.
The migration is straightforward: the old actor is stopped and a fresh actor is
started on the newly created `ActorSystem`. Notice this means the average is
reset: if you want your state to be persisted you'll need to take care of this
yourself. For this reason Cluster Sharding and Akka Persistence are such a
popular combination.
+Some of the temperature aggregators that were originally on the `ActorSystem`
on port 7345 will be migrated to the newly joined `ActorSystem` on port 7355.
The migration is straightforward: the old actor is stopped and a fresh actor is
started on the newly created `ActorSystem`. Notice this means the average is
reset: if you want your state to be persisted you'll need to take care of this
yourself. For this reason Cluster Sharding and Apache Pekko Persistence are
such a popular combination.
Start another node in the third terminal window with the following command:
@@ -143,7 +143,7 @@ Start even more nodes in the same way, if you like.
Each node's log will show its dynamic weather port opened for weather stations
to connect to.
```
-[2020-01-16 13:44:58,842] [INFO] [] [akka.actor.typed.ActorSystem]
[KillrWeather-akka.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:12553/
+[2020-01-16 13:44:58,842] [INFO] [] [pekko.actor.typed.ActorSystem]
[KillrWeather-pekko.actor.default-dispatcher-3] [] - WeatherServer online at
http://127.0.0.1:17345/
```
@@ -154,13 +154,13 @@ With the cluster running you can interact with the HTTP
endpoint using raw HTTP,
Record data for station 62:
```
-curl -XPOST http://localhost:12553/weather/62 -H "Content-Type:
application/json" --data '{"eventTime": 1579106781, "dataType": "temperature",
"value": 10.3}'
+curl -XPOST http://localhost:17345/weather/62 -H "Content-Type:
application/json" --data '{"eventTime": 1579106781, "dataType": "temperature",
"value": 10.3}'
```
Query average temperature for station 62:
```
-curl "http://localhost:12553/weather/62?type=temperature&function=average"
+curl "http://localhost:17345/weather/62?type=temperature&function=average"
```
### The Fog Network
diff --git a/akka-sample-sharding-scala/build.sbt
b/pekko-sample-sharding-scala/build.sbt
similarity index 55%
rename from akka-sample-sharding-scala/build.sbt
rename to pekko-sample-sharding-scala/build.sbt
index fa35f40..d9ea4c5 100644
--- a/akka-sample-sharding-scala/build.sbt
+++ b/pekko-sample-sharding-scala/build.sbt
@@ -1,10 +1,12 @@
-val AkkaVersion = "2.6.20"
-val AkkaHttpVersion = "10.1.11"
+val pekkoVersion = "0.0.0+26623-85c2a469-SNAPSHOT"
+val pekkoHttpVersion = "0.0.0+4335-81a9800e-SNAPSHOT"
val LogbackVersion = "1.2.11"
lazy val buildSettings = Seq(
- organization := "com.lightbend.akka.samples",
- scalaVersion := "2.13.8")
+ organization := "org.apache.pekko",
+ scalaVersion := "2.13.8",
+ // allow access to snapshots
+ resolvers += "Apache Nexus
Snapshots".at("https://repository.apache.org/content/groups/snapshots/"))
lazy val commonScalacOptions = Seq(
"-deprecation",
@@ -29,33 +31,35 @@ lazy val commonSettings = Seq(
lazy val killrweather = project
.in(file("killrweather"))
+ .settings(buildSettings)
.settings(commonSettings)
.settings(
Compile / run / mainClass := Some("sample.killrweather.KillrWeather"),
libraryDependencies ++= Seq(
- "com.typesafe.akka" %% "akka-cluster-sharding-typed" % AkkaVersion,
- "com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion,
- "com.typesafe.akka" %% "akka-distributed-data" % AkkaVersion,
- "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion,
- "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
- "com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion,
+ "org.apache.pekko" %% "pekko-cluster-sharding-typed" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-distributed-data" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
+ "org.apache.pekko" %% "pekko-http-spray-json" % pekkoHttpVersion,
"ch.qos.logback" % "logback-classic" % LogbackVersion))
lazy val `killrweather-fog` = project
.in(file("killrweather-fog"))
+ .settings(buildSettings)
.settings(commonSettings)
.settings(
Compile / run / mainClass := Some("sample.killrweather.fog.Fog"),
libraryDependencies ++= Seq(
- "com.typesafe.akka" %% "akka-actor-typed" % AkkaVersion,
- "com.typesafe.akka" %% "akka-stream-typed" % AkkaVersion,
- "com.typesafe.akka" %% "akka-http" % AkkaHttpVersion,
- "com.typesafe.akka" %% "akka-http-spray-json" % AkkaHttpVersion,
- "com.typesafe.akka" %% "akka-serialization-jackson" % AkkaVersion,
- "com.typesafe.akka" %% "akka-slf4j" % AkkaVersion,
+ "org.apache.pekko" %% "pekko-actor-typed" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-stream-typed" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-http" % pekkoHttpVersion,
+ "org.apache.pekko" %% "pekko-http-spray-json" % pekkoHttpVersion,
+ "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-slf4j" % pekkoVersion,
"ch.qos.logback" % "logback-classic" % LogbackVersion))
// Startup aliases for the first two seed nodes and a third, more can be
started.
-addCommandAlias("sharding1", "runMain sample.killrweather.KillrWeather 2551")
-addCommandAlias("sharding2", "runMain sample.killrweather.KillrWeather 2552")
+addCommandAlias("sharding1", "runMain sample.killrweather.KillrWeather 7345")
+addCommandAlias("sharding2", "runMain sample.killrweather.KillrWeather 7355")
addCommandAlias("sharding3", "runMain sample.killrweather.KillrWeather 0")
diff --git
a/akka-sample-sharding-java/killrweather-fog/src/main/resources/application.conf
b/pekko-sample-sharding-scala/killrweather-fog/src/main/resources/application.conf
similarity index 94%
rename from
akka-sample-sharding-java/killrweather-fog/src/main/resources/application.conf
rename to
pekko-sample-sharding-scala/killrweather-fog/src/main/resources/application.conf
index 1dc0048..5492175 100644
---
a/akka-sample-sharding-java/killrweather-fog/src/main/resources/application.conf
+++
b/pekko-sample-sharding-scala/killrweather-fog/src/main/resources/application.conf
@@ -2,7 +2,7 @@
# KillrWeather weather station and device config
######################################################
-akka.loglevel = DEBUG
+pekko.loglevel = DEBUG
killrweather.fog {
# Initial number of weather stations
diff --git
a/akka-sample-sharding-scala/killrweather-fog/src/main/resources/logback.xml
b/pekko-sample-sharding-scala/killrweather-fog/src/main/resources/logback.xml
similarity index 100%
rename from
akka-sample-sharding-scala/killrweather-fog/src/main/resources/logback.xml
rename to
pekko-sample-sharding-scala/killrweather-fog/src/main/resources/logback.xml
diff --git
a/akka-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/Fog.scala
b/pekko-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/Fog.scala
similarity index 88%
rename from
akka-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/Fog.scala
rename to
pekko-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/Fog.scala
index 9d5aab8..de1b300 100644
---
a/akka-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/Fog.scala
+++
b/pekko-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/Fog.scala
@@ -1,9 +1,9 @@
package sample.killrweather.fog
-import akka.actor.typed.SupervisorStrategy
-import akka.actor.typed.scaladsl.Behaviors
-import akka.actor.typed.ActorSystem
-import akka.actor.typed.Behavior
+import org.apache.pekko.actor.typed.SupervisorStrategy
+import org.apache.pekko.actor.typed.scaladsl.Behaviors
+import org.apache.pekko.actor.typed.ActorSystem
+import org.apache.pekko.actor.typed.Behavior
import com.typesafe.config.Config
import scala.concurrent.duration._
@@ -50,7 +50,7 @@ object FogSettings {
}
def apply(config: Config): FogSettings = {
- import akka.util.Helpers.Requiring
+ import org.apache.pekko.util.Helpers.Requiring
val millis = (durationKey: String) =>
config.getDuration(durationKey).toMillis.millis
diff --git
a/akka-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala
b/pekko-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala
similarity index 87%
rename from
akka-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala
rename to
pekko-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala
index 4012b41..3108133 100644
---
a/akka-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala
+++
b/pekko-sample-sharding-scala/killrweather-fog/src/main/scala/sample/killrweather/fog/WeatherStation.scala
@@ -1,13 +1,13 @@
package sample.killrweather.fog
-import akka.actor.typed.Behavior
-import akka.actor.typed.scaladsl.ActorContext
-import akka.actor.typed.scaladsl.Behaviors
-import akka.actor.typed.scaladsl.LoggerOps
-import akka.http.scaladsl.Http
-import akka.http.scaladsl.client.RequestBuilding.Post
-import akka.http.scaladsl.unmarshalling.Unmarshal
-import akka.stream.SystemMaterializer
+import org.apache.pekko.actor.typed.Behavior
+import org.apache.pekko.actor.typed.scaladsl.ActorContext
+import org.apache.pekko.actor.typed.scaladsl.Behaviors
+import org.apache.pekko.actor.typed.scaladsl.LoggerOps
+import org.apache.pekko.http.scaladsl.Http
+import org.apache.pekko.http.scaladsl.client.RequestBuilding.Post
+import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshal
+import org.apache.pekko.stream.SystemMaterializer
import scala.concurrent.Future
import scala.util.Failure
@@ -48,7 +48,7 @@ private class WeatherStation(context:
ActorContext[WeatherStation.Command], wsid
private val random = new Random()
private val http = {
- import akka.actor.typed.scaladsl.adapter._
+ import org.apache.pekko.actor.typed.scaladsl.adapter._
Http(context.system.toClassic)
}
private val stationUrl = s"http://${settings.host}:${httpPort}/weather/$wsid"
@@ -91,7 +91,7 @@ private class WeatherStation(context:
ActorContext[WeatherStation.Command], wsid
// we could also use a class and a Json formatter like in the server
// but since this is the only json we send this is a bit more concise
import spray.json._
- import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
+ import
org.apache.pekko.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
val json = JsObject(
"eventTime" -> JsNumber(eventTime),
"dataType" -> JsString("temperature"),
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/resources/application.conf
b/pekko-sample-sharding-scala/killrweather/src/main/resources/application.conf
similarity index 78%
rename from
akka-sample-sharding-scala/killrweather/src/main/resources/application.conf
rename to
pekko-sample-sharding-scala/killrweather/src/main/resources/application.conf
index 6bbc353..e8bddfa 100644
---
a/akka-sample-sharding-scala/killrweather/src/main/resources/application.conf
+++
b/pekko-sample-sharding-scala/killrweather/src/main/resources/application.conf
@@ -2,7 +2,7 @@
# KillrWeather cluster config
######################################################
-akka {
+pekko {
loglevel = DEBUG
actor {
@@ -22,14 +22,14 @@ akka {
cluster {
seed-nodes = [
- "akka://[email protected]:2553",
- "akka://[email protected]:2554"]
+ "pekko://[email protected]:7345",
+ "pekko://[email protected]:7355"]
sharding {
number-of-shards = 100
}
- downing-provider-class = "akka.cluster.sbr.SplitBrainResolverProvider"
+ downing-provider-class = "pekko.cluster.sbr.SplitBrainResolverProvider"
}
}
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/resources/logback.xml
b/pekko-sample-sharding-scala/killrweather/src/main/resources/logback.xml
similarity index 100%
rename from
akka-sample-sharding-scala/killrweather/src/main/resources/logback.xml
rename to
pekko-sample-sharding-scala/killrweather/src/main/resources/logback.xml
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/CborSerializable.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/CborSerializable.scala
similarity index 100%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/CborSerializable.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/CborSerializable.scala
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/Guardian.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/Guardian.scala
similarity index 79%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/Guardian.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/Guardian.scala
index b8ab98a..31cacd7 100644
---
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/Guardian.scala
+++
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/Guardian.scala
@@ -1,7 +1,7 @@
package sample.killrweather
-import akka.actor.typed.Behavior
-import akka.actor.typed.scaladsl.Behaviors
+import org.apache.pekko.actor.typed.Behavior
+import org.apache.pekko.actor.typed.scaladsl.Behaviors
/**
* Root actor bootstrapping the application
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JacksonSerializers.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JacksonSerializers.scala
similarity index 100%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JacksonSerializers.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JacksonSerializers.scala
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JsonFormats.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JsonFormats.scala
similarity index 100%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JsonFormats.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/JsonFormats.scala
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala
similarity index 80%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala
index b5687c8..60f8b8a 100644
---
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala
+++
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/KillrWeather.scala
@@ -1,7 +1,7 @@
package sample.killrweather
-import akka.actor.AddressFromURIString
-import akka.actor.typed.ActorSystem
+import org.apache.pekko.actor.AddressFromURIString
+import org.apache.pekko.actor.typed.ActorSystem
import com.typesafe.config.Config
import com.typesafe.config.ConfigFactory
import scala.collection.JavaConverters._
@@ -13,7 +13,7 @@ import scala.collection.JavaConverters._
object KillrWeather {
def main(args: Array[String]): Unit = {
- val seedNodePorts =
ConfigFactory.load().getStringList("akka.cluster.seed-nodes")
+ val seedNodePorts =
ConfigFactory.load().getStringList("pekko.cluster.seed-nodes")
.asScala
.flatMap { case AddressFromURIString(s) => s.port }
@@ -29,7 +29,7 @@ object KillrWeather {
ports.foreach { port =>
val httpPort =
- if (port > 0) 10000 + port // offset from akka port
+ if (port > 0) 10000 + port // offset from pekko port
else 0 // let OS decide
val config = configWithPort(port)
@@ -39,7 +39,7 @@ object KillrWeather {
private def configWithPort(port: Int): Config =
ConfigFactory.parseString(s"""
- akka.remote.artery.canonical.port = $port
+ pekko.remote.artery.canonical.port = $port
""").withFallback(ConfigFactory.load())
}
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala
similarity index 81%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala
index d4ae8d5..f327b55 100644
---
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala
+++
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherHttpServer.scala
@@ -3,11 +3,11 @@ package sample.killrweather
import scala.util.{ Failure, Success }
import scala.concurrent.duration._
-import akka.actor.typed.ActorSystem
-import akka.actor.CoordinatedShutdown
-import akka.{ actor => classic, Done }
-import akka.http.scaladsl.Http
-import akka.http.scaladsl.server.Route
+import org.apache.pekko.actor.typed.ActorSystem
+import org.apache.pekko.actor.CoordinatedShutdown
+import org.apache.pekko.{ actor => classic, Done }
+import org.apache.pekko.http.scaladsl.Http
+import org.apache.pekko.http.scaladsl.server.Route
private[killrweather] object WeatherHttpServer {
@@ -15,7 +15,7 @@ private[killrweather] object WeatherHttpServer {
* Logic to bind the given routes to a HTTP port and add some logging around
it
*/
def start(routes: Route, port: Int, system: ActorSystem[_]): Unit = {
- import akka.actor.typed.scaladsl.adapter._
+ import org.apache.pekko.actor.typed.scaladsl.adapter._
implicit val classicSystem: classic.ActorSystem = system.toClassic
val shutdown = CoordinatedShutdown(classicSystem)
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala
similarity index 79%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala
index 457b1d4..637f6a8 100644
---
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala
+++
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherRoutes.scala
@@ -2,12 +2,12 @@ package sample.killrweather
import scala.concurrent.Future
import scala.concurrent.duration._
-import akka.actor.typed.ActorSystem
-import akka.cluster.sharding.typed.scaladsl.ClusterSharding
-import akka.http.scaladsl.model.StatusCodes
-import akka.http.scaladsl.server.Route
-import akka.http.scaladsl.unmarshalling.Unmarshaller
-import akka.util.Timeout
+import org.apache.pekko.actor.typed.ActorSystem
+import org.apache.pekko.cluster.sharding.typed.scaladsl.ClusterSharding
+import org.apache.pekko.http.scaladsl.model.StatusCodes
+import org.apache.pekko.http.scaladsl.server.Route
+import org.apache.pekko.http.scaladsl.unmarshalling.Unmarshaller
+import org.apache.pekko.util.Timeout
/**
* HTTP API for
@@ -45,15 +45,15 @@ private[killrweather] final class WeatherRoutes(system:
ActorSystem[_]) {
Unmarshaller.strict[String, WeatherStation.DataType](text =>
dataTypesFromNames(text.toLowerCase))
// imports needed for the routes and entity json marshalling
- import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
- import akka.http.scaladsl.server.Directives._
+ import
org.apache.pekko.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
+ import org.apache.pekko.http.scaladsl.server.Directives._
import JsonFormats._
val weather: Route =
path("weather" / LongNumber) { wsid =>
concat(
get {
- parameters(("type".as[WeatherStation.DataType],
"function".as[WeatherStation.Function])) {
+ parameters("type".as[WeatherStation.DataType],
"function".as[WeatherStation.Function]) {
(dataType, function) =>
complete(query(wsid, dataType, function))
}
diff --git
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherStation.scala
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherStation.scala
similarity index 90%
rename from
akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherStation.scala
rename to
pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherStation.scala
index bd27e76..6e48a94 100644
---
a/akka-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherStation.scala
+++
b/pekko-sample-sharding-scala/killrweather/src/main/scala/sample/killrweather/WeatherStation.scala
@@ -1,15 +1,15 @@
package sample.killrweather
-import akka.actor.typed.PostStop
-import akka.actor.typed.scaladsl.ActorContext
-import akka.actor.typed.scaladsl.Behaviors
-import akka.actor.typed.scaladsl.LoggerOps
-import akka.actor.typed.ActorRef
-import akka.actor.typed.ActorSystem
-import akka.actor.typed.Behavior
-import akka.cluster.sharding.typed.scaladsl.ClusterSharding
-import akka.cluster.sharding.typed.scaladsl.Entity
-import akka.cluster.sharding.typed.scaladsl.EntityTypeKey
+import org.apache.pekko.actor.typed.PostStop
+import org.apache.pekko.actor.typed.scaladsl.ActorContext
+import org.apache.pekko.actor.typed.scaladsl.Behaviors
+import org.apache.pekko.actor.typed.scaladsl.LoggerOps
+import org.apache.pekko.actor.typed.ActorRef
+import org.apache.pekko.actor.typed.ActorSystem
+import org.apache.pekko.actor.typed.Behavior
+import org.apache.pekko.cluster.sharding.typed.scaladsl.ClusterSharding
+import org.apache.pekko.cluster.sharding.typed.scaladsl.Entity
+import org.apache.pekko.cluster.sharding.typed.scaladsl.EntityTypeKey
import com.fasterxml.jackson.databind.annotation.JsonDeserialize
import com.fasterxml.jackson.databind.annotation.JsonSerialize
diff --git a/akka-sample-sharding-scala/project/build.properties
b/pekko-sample-sharding-scala/project/build.properties
similarity index 100%
rename from akka-sample-sharding-scala/project/build.properties
rename to pekko-sample-sharding-scala/project/build.properties
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]