apache / pekko-samples Goto Github PK
View Code? Open in Web Editor NEWApache Pekko Sample Projects
Home Page: https://pekko.apache.org/
License: Apache License 2.0
Apache Pekko Sample Projects
Home Page: https://pekko.apache.org/
License: Apache License 2.0
On a stable Debian (OpenJDK 17), the example pekko-sample-distributed-workers-scala will fail on a exception while using sbt run
or sbt "runMain worker.Main cassandra"
.
The logs
Starting Cassandra on port client port: 9042 storage port 45209 host 127.0.0.1 java version 17.0.10+7-Debian-1deb12u1
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.apache.cassandra.security.ThreadAwareSecurityManager (file …/pekko-samples/pekko-sample-distributed-workers-scala/target/cassandra-db/cassandra-bundle.jar)
WARNING: Please consider reporting this to the maintainers of org.apache.cassandra.security.ThreadAwareSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
Exception (java.lang.AssertionError) encountered during startup: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @11b03c1f
java.lang.AssertionError: java.lang.reflect.InaccessibleObjectException: Unable to make field private int java.io.FileDescriptor.fd accessible: module java.base does not "opens java.io" to unnamed module @11b03c1f
…
[error] at worker.Main$.startCassandraDatabase(Main.scala:101)
The Simple Cluster Example does not work.
Looking in depth at the ...../simple/App.java class file and its methods I noticed a wrong config property in the private static void startup(int port)
(see line 38)
The line is
overrides.put("org.apache.pekko.remote.artery.canonical.port", port);
and should be changed to
overrides.put("pekko.remote.artery.canonical.port", port);
Reading the Artery Remoting documentation (https://pekko.apache.org/docs/pekko/current/remoting-artery.html) the right config property is "pekko.remote.artery.canonical.port"
After this change the Simple Cluster Example works very well !!!
The pekko-sample-cluster-java README.md docs refer to:
Distributed Workers With Akka - https://developer.lightbend.com/guides/akka-distributed-workers-java/
This seems to be non-existent. We have a Scala sample like this but not a Java one.
In #33, I'm changing the link to be to the existent Scala sample. Maybe, someone with time and an interest in Java support will write the Java equivalent.
Also fix any deprecation warnings. Many will be because prop in Category
style is deprecated in favour of Category / prop
style.
A recent PR tried to change to use Pekko paradox plugin but the change seems not to work. The look and feel of https://pekko.apache.org/docs/pekko-samples/current/pekko-sample-cluster-scala/ is the standard Paradox look and feel as opposed to the Pekko variant (eg https://pekko.apache.org)
@sam-byng fyi
The Simple Cluster Example does not work.
Looking in depth at the ..../simple/App.java class file and its methods, I noticed that there is a wrong configuration property in the method private static void startup(int port)
(see line 38).
The line is:
overrides.put("org.apache.pekko.remote.artery.canonical.port", port);
and should be changed to:
overrides.put("pekko.remote.artery.canonical.port", port);
Reading the Artery Remoting documentation (https://pekko.apache.org/docs/pekko/current/remoting-artery.html) the right property is "pekko.remote.artery.canonical.port"
After this change the sample works very well.
The current application.conf
configuration in the pekko-sample-cluster-kubernetes-scala
project lacks the essential http
settings under pekko.management
. This omission prevents the application from binding to the required port (8558), which is necessary for Kubernetes health checks. Without this configuration, Kubernetes cannot perform health checks, leading to immediate termination of the pods as they are marked unhealthy.
To resolve this critical issue and stabilize pod deployment, the following http
settings need to be explicitly defined in the application.conf
file:
#management-config
pekko.management {
cluster.bootstrap {
contact-point-discovery {
# pick the discovery method you'd like to use:
discovery-method = kubernetes-api
required-contact-point-nr = ${REQUIRED_CONTACT_POINT_NR}
}
}
# Add these so the pods won't get killed.
http {
port = 8558
bind-hostname = "0.0.0.0"
}
}
By including these settings, Kubernetes can access the management HTTP server on port 8558 for health checks, ensuring the pods are correctly recognized as healthy and operational.
`
private def startup(role: String, port: Int): Unit = {
// Override the configuration of the port when specified as program argument
val config = ConfigFactory
.parseString(s"""
org.apache.pekko.remote.artery.canonical.port=$port // It should be pekko.remote.artery.canonical.port
org.apache.pekko.cluster.roles = [$role] //It should be pekko.cluster.roles
""")
.withFallback(ConfigFactory.load("stats"))
ActorSystem[Nothing](RootBehavior(), "ClusterSystem", config)
}
`
I raised an issue on akka-samples re: the outdated cluster-client example
akka/akka-samples#280 (comment)
Response was that this was intended for initial migration onto the grpc cluster client, and isn't relevant now.
Can we remove this too?
Side note: are we 'allowed' to go and communicate on the Akka repositories when we see bugs/ have questions?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.