You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by fa...@apache.org on 2023/03/16 19:57:40 UTC
[incubator-pekko-samples] branch main updated: Issue 243: Update cluster client scala to Pekko (#12)
This is an automated email from the ASF dual-hosted git repository.
fanningpj 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 c0338c5 Issue 243: Update cluster client scala to Pekko (#12)
c0338c5 is described below
commit c0338c5962f810955e86146f18399d78d19451d6
Author: Sam Byng <43...@users.noreply.github.com>
AuthorDate: Thu Mar 16 19:57:34 2023 +0000
Issue 243: Update cluster client scala to Pekko (#12)
* sambyng/gh-243: Change cluster-client-grpc-scala dir to have pekko prefix
* Convert pekko-sample-cluster-client-grpc-scala
update build.sbt
Update plugins list for pekko-sample-cluster-client-grpc-scala
`- note sbt-pekko-grpc is the correct naming convention since looking at the grpc project build we have the plugin with name =
sbt-"$pekkoPrefix" [where pekkoPrefix=pekko-grpc]
Update application.conf to point at pekko
Update pekko-sample-cluster-client-grpc-scala source code files to point at pekko
* Update documentation: Update URLs to point to pekko.apache.org/docs/pekko/current ; Update READMEs to refer to Pekko ;
NOTE: No change to lightbend URLs since need to find equivalent docs
* In source code, Configs use pekko prefix instead of akka
* Update build-test.yml to point at new dirnames
* 243: Update build.sbt files to have a resolver to find the Pekko snapshots in the Apache repository
* Add resolvers to pom.xml / build.sbt files for cluster-client
* Update Artery remoting ports 25251/25252 to 17356/17357
* Issue 243: cluster-client-grpc-scala: Workaround build failures by adding an implicit ActorSystem variable to the chain of ClusterClient objects
sbt multi-jvm:test passed after this.
Unsure why this change is needed here. But it seems that the ActorSystem now must be implicitly brought in to context of Client instantiation
---------
Co-authored-by: sb5 <sb...@ad.datcon.co.uk>
---
.github/workflows/build-test.yml | 4 +--
.../project/plugins.sbt | 3 --
.../LICENSE | 0
.../README.md | 6 ++--
.../build.sbt | 21 +++++++------
.../project/build.properties | 0
.../project/plugins.sbt | 6 ++++
.../src/main/protobuf/clusterclient.proto | 0
.../src/main/resources/application.conf | 4 +--
.../cluster/client/grpc/CborSerializable.scala | 0
.../sample/cluster/client/grpc/ClusterClient.scala | 27 ++++++++---------
.../client/grpc/ClusterClientReceptionist.scala | 34 +++++++++++-----------
.../grpc/ClusterClientReceptionistGrpcImpl.scala | 16 +++++-----
.../client/grpc/ClusterClientSerialization.scala | 6 ++--
.../cluster/client/grpc/ClusterClientSpec.scala | 34 +++++++++++-----------
pekko-sample-cluster-java/README.md | 20 ++++++-------
.../src/main/java/sample/cluster/simple/App.java | 4 +--
.../src/main/java/sample/cluster/stats/App.java | 4 +--
.../java/sample/cluster/stats/AppOneMaster.java | 4 +--
.../java/sample/cluster/transformation/App.java | 4 +--
.../src/main/resources/application.conf | 4 +--
pekko-sample-cluster-scala/README.md | 20 ++++++-------
.../src/main/resources/application.conf | 4 +--
.../src/main/scala/sample/cluster/simple/App.scala | 2 +-
.../src/main/scala/sample/cluster/stats/App.scala | 4 +--
.../scala/sample/cluster/stats/AppOneMaster.scala | 4 +--
.../scala/sample/cluster/transformation/App.scala | 4 +--
27 files changed, 123 insertions(+), 116 deletions(-)
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 41aa8e7..8e2e90b 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -28,8 +28,8 @@ jobs:
- name: Test pekko-sample-cluster-scala
run: cd pekko-sample-cluster-scala && sbt multi-jvm:test
- - name: Test akka-sample-cluster-client-grpc-scala
- run: cd akka-sample-cluster-client-grpc-scala && sbt multi-jvm:test
+ - name: Test pekko-sample-cluster-client-grpc-scala
+ run: cd pekko-sample-cluster-client-grpc-scala && sbt multi-jvm:test
- name: Test akka-sample-cluster-client-grpc-java
run: cd akka-sample-cluster-client-grpc-java && mvn test
diff --git a/akka-sample-cluster-client-grpc-scala/project/plugins.sbt b/akka-sample-cluster-client-grpc-scala/project/plugins.sbt
deleted file mode 100644
index 1bcdc24..0000000
--- a/akka-sample-cluster-client-grpc-scala/project/plugins.sbt
+++ /dev/null
@@ -1,3 +0,0 @@
-addSbtPlugin("com.lightbend.akka.grpc" % "sbt-akka-grpc" % "0.8.4")
-addSbtPlugin("com.lightbend.sbt" % "sbt-javaagent" % "0.1.4")
-addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0")
diff --git a/akka-sample-cluster-client-grpc-scala/LICENSE b/pekko-sample-cluster-client-grpc-scala/LICENSE
similarity index 100%
rename from akka-sample-cluster-client-grpc-scala/LICENSE
rename to pekko-sample-cluster-client-grpc-scala/LICENSE
diff --git a/akka-sample-cluster-client-grpc-scala/README.md b/pekko-sample-cluster-client-grpc-scala/README.md
similarity index 70%
rename from akka-sample-cluster-client-grpc-scala/README.md
rename to pekko-sample-cluster-client-grpc-scala/README.md
index c8de095..35db6ff 100644
--- a/akka-sample-cluster-client-grpc-scala/README.md
+++ b/pekko-sample-cluster-client-grpc-scala/README.md
@@ -1,7 +1,7 @@
# Cluster Client with gRPC transport
See purpose of this example and important clarifications of when to use this approach in
-[Migration to Akka gRPC](https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-apache-pekko-grpc).
+[Migration to Apache Pekko gRPC](https://pekko.apache.org/docs/pekko/current/cluster-client.html#migration-to-apache-pekko-grpc).
Project structure:
@@ -10,5 +10,5 @@ Project structure:
* [ClusterClient](src/main/scala/sample/cluster/client/grpc/ClusterClient.scala) is the actor on the client
side that messages are sent via
* [ClusterClientReceptionist](src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala)
- is an Akka extension on the cluster (server) side that implements the gPRC service and delegates
- messages to actors in the cluster that have been registered in Distributed PubSub.
+ is an Apache Pekko extension on the cluster (server) side that implements the gPRC service and delegates
+ messages to actors in the cluster that have been registered in Distributed PubSub.
diff --git a/akka-sample-cluster-client-grpc-scala/build.sbt b/pekko-sample-cluster-client-grpc-scala/build.sbt
similarity index 50%
rename from akka-sample-cluster-client-grpc-scala/build.sbt
rename to pekko-sample-cluster-client-grpc-scala/build.sbt
index ea5dc91..1fc0e1b 100644
--- a/akka-sample-cluster-client-grpc-scala/build.sbt
+++ b/pekko-sample-cluster-client-grpc-scala/build.sbt
@@ -1,15 +1,18 @@
import com.typesafe.sbt.SbtMultiJvm.multiJvmSettings
import com.typesafe.sbt.SbtMultiJvm.MultiJvmKeys.MultiJvm
-val akkaVersion = "2.6.20"
+val pekkoVersion = "0.0.0+26617-325e2156-SNAPSHOT"
-lazy val `akka-sample-cluster-client-grpc-scala` = project
+// allow access to snapshots
+resolvers += "Apache Snapshots".at("https://repository.apache.org/content/repositories/snapshots/")
+
+lazy val `pekko-sample-cluster-client-grpc-scala` = project
.in(file("."))
.enablePlugins(JavaAgent)
- .enablePlugins(AkkaGrpcPlugin)
+ .enablePlugins(PekkoGrpcPlugin)
.settings(multiJvmSettings: _*)
.settings(
- organization := "com.typesafe.akka",
+ organization := "org.apache.pekko",
scalaVersion := "2.13.8",
Compile / scalacOptions ++= Seq(
"-deprecation",
@@ -21,11 +24,11 @@ lazy val `akka-sample-cluster-client-grpc-scala` = project
Compile / javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"),
// javaAgents += "org.mortbay.jetty.alpn" % "jetty-alpn-agent" % "2.0.9" % "runtime",
libraryDependencies ++= Seq(
- "com.typesafe.akka" %% "akka-cluster" % akkaVersion,
- "com.typesafe.akka" %% "akka-cluster-tools" % akkaVersion,
- "com.typesafe.akka" %% "akka-serialization-jackson" % akkaVersion,
- "com.typesafe.akka" %% "akka-discovery" % akkaVersion,
- "com.typesafe.akka" %% "akka-multi-node-testkit" % akkaVersion % Test,
+ "org.apache.pekko" %% "pekko-cluster" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-cluster-tools" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-discovery" % pekkoVersion,
+ "org.apache.pekko" %% "pekko-multi-node-testkit" % pekkoVersion % Test,
"org.scalatest" %% "scalatest" % "3.1.1" % Test
)
)
diff --git a/akka-sample-cluster-client-grpc-scala/project/build.properties b/pekko-sample-cluster-client-grpc-scala/project/build.properties
similarity index 100%
rename from akka-sample-cluster-client-grpc-scala/project/build.properties
rename to pekko-sample-cluster-client-grpc-scala/project/build.properties
diff --git a/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt b/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt
new file mode 100644
index 0000000..db78868
--- /dev/null
+++ b/pekko-sample-cluster-client-grpc-scala/project/plugins.sbt
@@ -0,0 +1,6 @@
+// allow access to snapshots
+resolvers += "Apache Snapshots".at("https://repository.apache.org/content/repositories/snapshots/")
+
+addSbtPlugin("org.apache.pekko" % "sbt-pekko-grpc" % "0.0.0-15-3d8bff9d-SNAPSHOT")
+addSbtPlugin("com.lightbend.sbt" % "sbt-javaagent" % "0.1.4")
+addSbtPlugin("com.typesafe.sbt" % "sbt-multi-jvm" % "0.4.0")
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/protobuf/clusterclient.proto b/pekko-sample-cluster-client-grpc-scala/src/main/protobuf/clusterclient.proto
similarity index 100%
rename from akka-sample-cluster-client-grpc-scala/src/main/protobuf/clusterclient.proto
rename to pekko-sample-cluster-client-grpc-scala/src/main/protobuf/clusterclient.proto
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/resources/application.conf b/pekko-sample-cluster-client-grpc-scala/src/main/resources/application.conf
similarity index 91%
rename from akka-sample-cluster-client-grpc-scala/src/main/resources/application.conf
rename to pekko-sample-cluster-client-grpc-scala/src/main/resources/application.conf
index 3cbbe70..f46d234 100644
--- a/akka-sample-cluster-client-grpc-scala/src/main/resources/application.conf
+++ b/pekko-sample-cluster-client-grpc-scala/src/main/resources/application.conf
@@ -23,10 +23,10 @@ sample.cluster.client.grpc {
buffer-size = 1000
}
-akka.actor {
+pekko.actor {
serialization-bindings {
"sample.cluster.client.grpc.CborSerializable" = jackson-cbor
}
}
-akka.http.server.preview.enable-http2 = on
+pekko.http.server.preview.enable-http2 = on
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/CborSerializable.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/CborSerializable.scala
similarity index 100%
rename from akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/CborSerializable.scala
rename to pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/CborSerializable.scala
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala
similarity index 90%
rename from akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala
rename to pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala
index 29f2e1e..78a90ea 100644
--- a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala
+++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClient.scala
@@ -1,11 +1,11 @@
package sample.cluster.client.grpc
-import akka.NotUsed
-import akka.actor.{Actor, ActorLogging, ActorRef, ActorSystem, Props, Terminated}
-import akka.event.LoggingAdapter
-import akka.grpc.GrpcClientSettings
-import akka.stream._
-import akka.stream.scaladsl.Source
+import org.apache.pekko.NotUsed
+import org.apache.pekko.actor.{Actor, ActorLogging, ActorRef, ActorSystem, Props, Terminated}
+import org.apache.pekko.event.LoggingAdapter
+import org.apache.pekko.grpc.GrpcClientSettings
+import org.apache.pekko.stream._
+import org.apache.pekko.stream.scaladsl.Source
import scala.concurrent.duration._
import scala.concurrent.{ExecutionContext, Future, Promise}
@@ -13,11 +13,11 @@ import scala.concurrent.{ExecutionContext, Future, Promise}
object ClusterClient {
/**
- * Factory method for `ClusterClient` [[akka.actor.Props]].
+ * Factory method for `ClusterClient` [[org.apache.pekko.actor.Props]].
*/
def props(
settings: ClusterClientSettings
- )(implicit materializer: Materializer): Props =
+ )(implicit materializer: Materializer, sys: ActorSystem): Props =
Props(new ClusterClient(settings))
sealed trait Command
@@ -49,7 +49,7 @@ object ClusterClient {
private def createClientStub(
settings: ClusterClientSettings
- )(implicit mat: Materializer): ClusterClientReceptionistServiceClient = {
+ )(implicit mat: Materializer, sys: ActorSystem): ClusterClientReceptionistServiceClient = {
implicit val ec: ExecutionContext = mat.executionContext
ClusterClientReceptionistServiceClient(settings.grpcClientSettings)
}
@@ -126,7 +126,7 @@ object ClusterClient {
/**
* This actor is intended to be used on an external node that is not member
* of the cluster. It acts like a gateway for sending messages to actors
- * somewhere in the cluster. With service discovery and Akka gRPC it will establish
+ * somewhere in the cluster. With service discovery and Apache Pekko gRPC it will establish
* a connection to a [[ClusterClientReceptionist]] somewhere in the cluster.
*
* You can send messages via the `ClusterClient` to any actor in the cluster
@@ -150,7 +150,7 @@ object ClusterClient {
* to the named topic.
*
* Use the factory method [[ClusterClient#props]]) to create the
- * [[akka.actor.Props]] for the actor.
+ * [[org.apache.pekko.actor.Props]] for the actor.
*
* If the receptionist is not currently available, the client will buffer the messages
* and then deliver them when the connection to the receptionist has been established.
@@ -162,7 +162,8 @@ object ClusterClient {
* nature of the actors involved.
*/
final class ClusterClient(settings: ClusterClientSettings)(
- implicit materializer: Materializer
+ implicit materializer: Materializer,
+ sys: ActorSystem
) extends Actor
with ActorLogging {
@@ -185,7 +186,7 @@ final class ClusterClient(settings: ClusterClientSettings)(
def receive: Receive = {
case send: SendAsk =>
- import akka.pattern.pipe
+ import org.apache.pekko.pattern.pipe
import context.dispatcher
askSend(receptionistServiceClient, send, serialization).pipeTo(sender())
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala
similarity index 82%
rename from akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala
rename to pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala
index 3423159..fba8665 100644
--- a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala
+++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionist.scala
@@ -6,21 +6,21 @@ import scala.concurrent.Future
import scala.concurrent.duration.FiniteDuration
import scala.concurrent.duration._
-import akka.actor.ActorRef
-import akka.actor.ActorSystem
-import akka.actor.ExtendedActorSystem
-import akka.actor.Extension
-import akka.actor.ExtensionId
-import akka.actor.ExtensionIdProvider
-import akka.cluster.Cluster
-import akka.cluster.pubsub.DistributedPubSub
-import akka.cluster.pubsub.DistributedPubSubMediator
-import akka.event.Logging
-import akka.http.scaladsl.Http
-import akka.http.scaladsl.HttpConnectionContext
-import akka.http.scaladsl.model.HttpRequest
-import akka.http.scaladsl.model.HttpResponse
-import akka.stream.Materializer
+import org.apache.pekko.actor.ActorRef
+import org.apache.pekko.actor.ActorSystem
+import org.apache.pekko.actor.ExtendedActorSystem
+import org.apache.pekko.actor.Extension
+import org.apache.pekko.actor.ExtensionId
+import org.apache.pekko.actor.ExtensionIdProvider
+import org.apache.pekko.cluster.Cluster
+import org.apache.pekko.cluster.pubsub.DistributedPubSub
+import org.apache.pekko.cluster.pubsub.DistributedPubSubMediator
+import org.apache.pekko.event.Logging
+import org.apache.pekko.http.scaladsl.Http
+import org.apache.pekko.http.scaladsl.HttpConnectionContext
+import org.apache.pekko.http.scaladsl.model.HttpRequest
+import org.apache.pekko.http.scaladsl.model.HttpResponse
+import org.apache.pekko.stream.Materializer
object ClusterClientReceptionist extends ExtensionId[ClusterClientReceptionist] with ExtensionIdProvider {
override def get(system: ActorSystem): ClusterClientReceptionist =
@@ -33,9 +33,9 @@ object ClusterClientReceptionist extends ExtensionId[ClusterClientReceptionist]
}
/**
- * Extension that starts gRPC service and accompanying `akka.cluster.pubsub.DistributedPubSubMediator`
+ * Extension that starts gRPC service and accompanying `org.apache.pekko.cluster.pubsub.DistributedPubSubMediator`
* with settings defined in config section `sample.cluster.client.grpc.receptionist`.
- * The `akka.cluster.pubsub.DistributedPubSubMediator` is started by the `akka.cluster.pubsub.DistributedPubSub`
+ * The `org.apache.pekko.cluster.pubsub.DistributedPubSubMediator` is started by the `org.apache.pekko.cluster.pubsub.DistributedPubSub`
* extension.
*/
final class ClusterClientReceptionist(system: ExtendedActorSystem) extends Extension {
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala
similarity index 89%
rename from akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala
rename to pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala
index 76d05db..5775da2 100644
--- a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala
+++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientReceptionistGrpcImpl.scala
@@ -2,13 +2,13 @@ package sample.cluster.client.grpc
import java.util.UUID
-import akka.NotUsed
-import akka.actor.ActorRef
-import akka.cluster.pubsub.DistributedPubSubMediator
-import akka.event.LoggingAdapter
-import akka.stream.{Materializer, OverflowStrategy}
-import akka.stream.scaladsl.Source
-import akka.util.Timeout
+import org.apache.pekko.NotUsed
+import org.apache.pekko.actor.ActorRef
+import org.apache.pekko.cluster.pubsub.DistributedPubSubMediator
+import org.apache.pekko.event.LoggingAdapter
+import org.apache.pekko.stream.{Materializer, OverflowStrategy}
+import org.apache.pekko.stream.scaladsl.Source
+import org.apache.pekko.util.Timeout
import scala.concurrent.Future
import scala.util.control.NonFatal
@@ -78,7 +78,7 @@ class ClusterClientReceptionistGrpcImpl(
override def askSend(sendReq: SendReq): Future[Rsp] = {
try {
- import akka.pattern.ask
+ import org.apache.pekko.pattern.ask
implicit val timeout = Timeout(settings.askSendTimeout)
implicit val ec = mat.executionContext
val msg = serialization.deserializePayload(sendReq.payload.get)
diff --git a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientSerialization.scala b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientSerialization.scala
similarity index 82%
rename from akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientSerialization.scala
rename to pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientSerialization.scala
index d4a6566..16ef8a1 100644
--- a/akka-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientSerialization.scala
+++ b/pekko-sample-cluster-client-grpc-scala/src/main/scala/sample/cluster/client/grpc/ClusterClientSerialization.scala
@@ -1,8 +1,8 @@
package sample.cluster.client.grpc
-import akka.actor.ActorSystem
-import akka.serialization.SerializationExtension
-import akka.serialization.Serializers
+import org.apache.pekko.actor.ActorSystem
+import org.apache.pekko.serialization.SerializationExtension
+import org.apache.pekko.serialization.Serializers
import com.google.protobuf.ByteString
class ClusterClientSerialization(system: ActorSystem) {
diff --git a/akka-sample-cluster-client-grpc-scala/src/multi-jvm/scala/sample/cluster/client/grpc/ClusterClientSpec.scala b/pekko-sample-cluster-client-grpc-scala/src/multi-jvm/scala/sample/cluster/client/grpc/ClusterClientSpec.scala
similarity index 91%
rename from akka-sample-cluster-client-grpc-scala/src/multi-jvm/scala/sample/cluster/client/grpc/ClusterClientSpec.scala
rename to pekko-sample-cluster-client-grpc-scala/src/multi-jvm/scala/sample/cluster/client/grpc/ClusterClientSpec.scala
index 9aee44a..342bdd9 100644
--- a/akka-sample-cluster-client-grpc-scala/src/multi-jvm/scala/sample/cluster/client/grpc/ClusterClientSpec.scala
+++ b/pekko-sample-cluster-client-grpc-scala/src/multi-jvm/scala/sample/cluster/client/grpc/ClusterClientSpec.scala
@@ -3,17 +3,17 @@ package sample.cluster.client.grpc
import scala.concurrent.Await
import scala.concurrent.duration._
-import akka.actor.Actor
-import akka.actor.ActorRef
-import akka.actor.Props
-import akka.cluster.Cluster
-import akka.cluster.pubsub._
-import akka.remote.testconductor.RoleName
-import akka.remote.testkit.MultiNodeConfig
-import akka.remote.testkit.MultiNodeSpec
-import akka.stream.Materializer
-import akka.testkit._
-import akka.util.Timeout
+import org.apache.pekko.actor.Actor
+import org.apache.pekko.actor.ActorRef
+import org.apache.pekko.actor.Props
+import org.apache.pekko.cluster.Cluster
+import org.apache.pekko.cluster.pubsub._
+import org.apache.pekko.remote.testconductor.RoleName
+import org.apache.pekko.remote.testkit.MultiNodeConfig
+import org.apache.pekko.remote.testkit.MultiNodeSpec
+import org.apache.pekko.stream.Materializer
+import org.apache.pekko.testkit._
+import org.apache.pekko.util.Timeout
import com.typesafe.config.ConfigFactory
import org.scalatest.BeforeAndAfterAll
import org.scalatest.Matchers
@@ -27,10 +27,10 @@ object ClusterClientSpec extends MultiNodeConfig {
val fourth = role("fourth")
commonConfig(ConfigFactory.parseString("""
- akka.loglevel = INFO
- akka.http.server.preview.enable-http2 = on
- akka.actor.provider = "cluster"
- akka.remote.artery.canonical.port = 0
+ pekko.loglevel = INFO
+ pekko.http.server.preview.enable-http2 = on
+ pekko.actor.provider = "cluster"
+ pekko.remote.artery.canonical.port = 0
""").withFallback(ConfigFactory.load()))
val grpcPorts: Map[RoleName, Int] =
@@ -169,7 +169,7 @@ class ClusterClientSpec
"work with ask and session" in within(10.seconds) {
// ask with Send is inefficient but should work
runOn(client) {
- import akka.pattern.ask
+ import org.apache.pekko.pattern.ask
val c = system.actorOf(ClusterClient.props(ClusterClientSettings(system)), "ask-session-client")
implicit val timeout = Timeout(remaining)
val reply1 = c ? ClusterClient.Send("/user/testService", "hello-1-request", localAffinity = true)
@@ -188,7 +188,7 @@ class ClusterClientSpec
"work with explicit ask" in within(10.seconds) {
runOn(client) {
- import akka.pattern.ask
+ import org.apache.pekko.pattern.ask
val c = system.actorOf(ClusterClient.props(ClusterClientSettings(system)), "ask-client")
implicit val timeout = Timeout(remaining)
val reply1 = c ? ClusterClient.SendAsk("/user/testService", "hello-1-request", localAffinity = true)
diff --git a/pekko-sample-cluster-java/README.md b/pekko-sample-cluster-java/README.md
index 9b47693..5d67de0 100644
--- a/pekko-sample-cluster-java/README.md
+++ b/pekko-sample-cluster-java/README.md
@@ -26,15 +26,15 @@ To run this sample, first make sure everything is compiled using `mvn compile`,
In the first terminal window, start the first seed node with the following command:
- mvn exec:java -Dexec.mainClass="sample.cluster.simple.App" -Dexec.args=25251
+ mvn exec:java -Dexec.mainClass="sample.cluster.simple.App" -Dexec.args=17356
-25251 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'.
+17356 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'.
In the second terminal window, start the second seed node with the following command:
- mvn exec:java -Dexec.mainClass="sample.cluster.simple.App" -Dexec.args=25252
+ mvn exec:java -Dexec.mainClass="sample.cluster.simple.App" -Dexec.args=17357
-25252 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'.
+17357 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.
@@ -71,9 +71,9 @@ To run this sample, make sure you have shut down any previously started cluster
TransformationApp starts 5 actor systems (cluster members) in the same JVM process. It can be more interesting to run them in separate processes. Stop the application and run the following commands in separate terminal windows.
- mvn exec:java -Dexec.mainClass="sample.cluster.transformation.App" -Dexec.args="backend 25251"
+ mvn exec:java -Dexec.mainClass="sample.cluster.transformation.App" -Dexec.args="backend 17356"
- mvn exec:java -Dexec.mainClass="sample.cluster.transformation.App" -Dexec.args="backend 25252"
+ mvn exec:java -Dexec.mainClass="sample.cluster.transformation.App" -Dexec.args="backend 17357"
mvn exec:java -Dexec.mainClass="sample.cluster.transformation.App" -Dexec.args="backend 0"
@@ -120,9 +120,9 @@ To run the sample, type `mvn exec:java -Dexec.mainClass="sample.cluster.stats.Ap
StatsSample starts 4 actor systems (cluster members) in the same JVM process. It can be more interesting to run them in separate processes. Stop the application and run the following commands in separate terminal windows.
- mvn exec:java -Dexec.mainClass="sample.cluster.stats.App" -Dexec.args="compute 25251"
+ mvn exec:java -Dexec.mainClass="sample.cluster.stats.App" -Dexec.args="compute 17356"
- mvn exec:java -Dexec.mainClass="sample.cluster.stats.App" -Dexec.args="compute 25252"
+ mvn exec:java -Dexec.mainClass="sample.cluster.stats.App" -Dexec.args="compute 17357"
mvn exec:java -Dexec.mainClass="sample.cluster.stats.App" -Dexec.args="compute 0"
@@ -145,9 +145,9 @@ To run this sample, type `mvn exec:java -Dexec.mainClass="sample.cluster.stats.A
AppOneMaster starts 4 actor systems (cluster members) in the same JVM process. It can be more interesting to run them in separate processes. Stop the application and run the following commands in separate terminal windows.
- mvn exec:java -Dexec.mainClass="sample.cluster.stats.AppOneMaster" -Dexec.args="compute 25251"
+ mvn exec:java -Dexec.mainClass="sample.cluster.stats.AppOneMaster" -Dexec.args="compute 17356"
- mvn exec:java -Dexec.mainClass="sample.cluster.stats.AppOneMaster" -Dexec.args="compute 25252"
+ mvn exec:java -Dexec.mainClass="sample.cluster.stats.AppOneMaster" -Dexec.args="compute 17357"
mvn exec:java -Dexec.mainClass="sample.cluster.stats.AppOneMaster" -Dexec.args="compute 0"
diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/simple/App.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/simple/App.java
index da059a3..8b37ee4 100644
--- a/pekko-sample-cluster-java/src/main/java/sample/cluster/simple/App.java
+++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/simple/App.java
@@ -14,8 +14,8 @@ public class App {
public static void main(String[] args) {
if (args.length == 0) {
- startup(25251);
- startup(25252);
+ startup(17356);
+ startup(17357);
startup(0);
} else
Arrays.stream(args).map(Integer::parseInt).forEach(App::startup);
diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java
index d9d1b49..6bbb916 100644
--- a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java
+++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/App.java
@@ -56,8 +56,8 @@ public class App {
public static void main(String[] args) {
if (args.length == 0) {
- startup("compute", 25251);
- startup("compute", 25252);
+ startup("compute", 17356);
+ startup("compute", 17357);
startup("compute", 0);
startup("client", 0);
} else {
diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java
index 1acd3e7..bb5e6fd 100644
--- a/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java
+++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/stats/AppOneMaster.java
@@ -71,8 +71,8 @@ public class AppOneMaster {
public static void main(String[] args) {
if (args.length == 0) {
- startup("compute", 25251);
- startup("compute", 25252);
+ startup("compute", 17356);
+ startup("compute", 17357);
startup("compute", 0);
startup("client", 0);
} else {
diff --git a/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java b/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java
index 61962ee..62c27cb 100644
--- a/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java
+++ b/pekko-sample-cluster-java/src/main/java/sample/cluster/transformation/App.java
@@ -36,8 +36,8 @@ public class App {
public static void main(String[] args) {
if (args.length == 0) {
- startup("backend", 25251);
- startup("backend", 25252);
+ startup("backend", 17356);
+ startup("backend", 17357);
startup("frontend", 0);
startup("frontend", 0);
startup("frontend", 0);
diff --git a/pekko-sample-cluster-java/src/main/resources/application.conf b/pekko-sample-cluster-java/src/main/resources/application.conf
index 488d6fe..b491f61 100644
--- a/pekko-sample-cluster-java/src/main/resources/application.conf
+++ b/pekko-sample-cluster-java/src/main/resources/application.conf
@@ -15,8 +15,8 @@ pekko {
}
cluster {
seed-nodes = [
- "pekko://ClusterSystem@127.0.0.1:25251",
- "pekko://ClusterSystem@127.0.0.1:25252"]
+ "pekko://ClusterSystem@127.0.0.1:17356",
+ "pekko://ClusterSystem@127.0.0.1:17357"]
downing-provider-class = "org.apache.pekko.cluster.sbr.SplitBrainResolverProvider"
}
}
diff --git a/pekko-sample-cluster-scala/README.md b/pekko-sample-cluster-scala/README.md
index 4d68ac4..04529c7 100644
--- a/pekko-sample-cluster-scala/README.md
+++ b/pekko-sample-cluster-scala/README.md
@@ -26,15 +26,15 @@ To run this sample, type `sbt "runMain sample.cluster.simple.App"`.
In the first terminal window, start the first seed node with the following command:
- sbt "runMain sample.cluster.simple.App 25251"
+ sbt "runMain sample.cluster.simple.App 17356"
-25251 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'.
+17356 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'.
In the second terminal window, start the second seed node with the following command:
- sbt "runMain sample.cluster.simple.App 25252"
+ sbt "runMain sample.cluster.simple.App 17357"
-25252 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'.
+17357 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.
@@ -71,9 +71,9 @@ To run this sample, make sure you have shut down any previously started cluster
TransformationApp starts 5 actor systems (cluster members) in the same JVM process. It can be more interesting to run them in separate processes. Stop the application and run the following commands in separate terminal windows.
- sbt "runMain sample.cluster.transformation.App backend 25251"
+ sbt "runMain sample.cluster.transformation.App backend 17356"
- sbt "runMain sample.cluster.transformation.App backend 25252"
+ sbt "runMain sample.cluster.transformation.App backend 17357"
sbt "runMain sample.cluster.transformation.App backend 0"
@@ -120,9 +120,9 @@ To run the sample, type `sbt "runMain sample.cluster.stats.App"` if it is not al
StatsSample starts 4 actor systems (cluster members) in the same JVM process. It can be more interesting to run them in separate processes. Stop the application and run the following commands in separate terminal windows.
- sbt "runMain sample.cluster.stats.App compute 25251"
+ sbt "runMain sample.cluster.stats.App compute 17356"
- sbt "runMain sample.cluster.stats.App compute 25252"
+ sbt "runMain sample.cluster.stats.App compute 17357"
sbt "runMain sample.cluster.stats.App compute 0"
@@ -145,9 +145,9 @@ To run this sample, type `sbt "runMain sample.cluster.stats.AppOneMaster"` if it
StatsSampleOneMaster starts 4 actor systems (cluster members) in the same JVM process. It can be more interesting to run them in separate processes. Stop the application and run the following commands in separate terminal windows.
- sbt "runMain sample.cluster.stats.AppOneMaster compute 25251"
+ sbt "runMain sample.cluster.stats.AppOneMaster compute 17356"
- sbt "runMain sample.cluster.stats.AppOneMaster compute 25252"
+ sbt "runMain sample.cluster.stats.AppOneMaster compute 17357"
sbt "runMain sample.cluster.stats.AppOneMaster compute 0"
diff --git a/pekko-sample-cluster-scala/src/main/resources/application.conf b/pekko-sample-cluster-scala/src/main/resources/application.conf
index ddd974c..2450924 100644
--- a/pekko-sample-cluster-scala/src/main/resources/application.conf
+++ b/pekko-sample-cluster-scala/src/main/resources/application.conf
@@ -14,8 +14,8 @@ pekko {
}
cluster {
seed-nodes = [
- "pekko://ClusterSystem@127.0.0.1:25251",
- "pekko://ClusterSystem@127.0.0.1:25252"]
+ "pekko://ClusterSystem@127.0.0.1:17356",
+ "pekko://ClusterSystem@127.0.0.1:17357"]
downing-provider-class = "org.apache.pekko.cluster.sbr.SplitBrainResolverProvider"
}
}
diff --git a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/simple/App.scala b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/simple/App.scala
index 75b7c09..320ea20 100644
--- a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/simple/App.scala
+++ b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/simple/App.scala
@@ -19,7 +19,7 @@ object App {
def main(args: Array[String]): Unit = {
val ports =
if (args.isEmpty)
- Seq(25251, 25252, 0)
+ Seq(17356, 17357, 0)
else
args.toSeq.map(_.toInt)
ports.foreach(startup)
diff --git a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/App.scala b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/App.scala
index 4b7852d..01f817e 100644
--- a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/App.scala
+++ b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/App.scala
@@ -45,8 +45,8 @@ object App {
def main(args: Array[String]): Unit = {
if (args.isEmpty) {
- startup("compute", 25251)
- startup("compute", 25252)
+ startup("compute", 17356)
+ startup("compute", 17357)
startup("compute", 0)
startup("client", 0)
} else {
diff --git a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/AppOneMaster.scala b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/AppOneMaster.scala
index 741064f..6bb1c7e 100644
--- a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/AppOneMaster.scala
+++ b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/stats/AppOneMaster.scala
@@ -61,8 +61,8 @@ object AppOneMaster {
def main(args: Array[String]): Unit = {
if (args.isEmpty) {
- startup("compute", 25251)
- startup("compute", 25252)
+ startup("compute", 17356)
+ startup("compute", 17357)
startup("compute", 0)
startup("client", 0)
} else {
diff --git a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/App.scala b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/App.scala
index 6b5d46a..ab0410d 100644
--- a/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/App.scala
+++ b/pekko-sample-cluster-scala/src/main/scala/sample/cluster/transformation/App.scala
@@ -28,8 +28,8 @@ object App {
def main(args: Array[String]): Unit = {
// starting 2 frontend nodes and 3 backend nodes
if (args.isEmpty) {
- startup("backend", 25251)
- startup("backend", 25252)
+ startup("backend", 17356)
+ startup("backend", 17357)
startup("frontend", 0)
startup("frontend", 0)
startup("frontend", 0)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org