Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pekko-sample-distributed-workers-scala/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ As long as one of the four nodes is alive the cluster will keep working. You can
You can start more cluster front-end nodes using port numbers between 3000-3999:

```bash
sbt "runMain worker.Main 3002
sbt "runMain worker.Main 3002"
```

Any port outside these ranges creates a worker node, for which you can also play around with the number of worker actors on using the second parameter.

```bash
sbt "runMain worker.Main 5009 4
sbt "runMain worker.Main 5009 4"
```

## The journal
Expand Down
4 changes: 2 additions & 2 deletions pekko-sample-distributed-workers-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-serialization-jackson" % pekkoVersion,
"org.apache.pekko" %% "pekko-persistence-cassandra" % cassandraPluginVersion,
// this allows us to start cassandra from the sample
"org.apache.pekko" %% "pekko-persistence-cassandra-launcher" % cassandraPluginVersion,
"org.testcontainers" % "testcontainers-cassandra" % "2.0.1",
"ch.qos.logback" % "logback-classic" % logbackVersion,
// test dependencies
"org.apache.pekko" %% "pekko-actor-testkit-typed" % pekkoVersion % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"commons-io" % "commons-io" % "2.11.0" % Test)
"commons-io" % "commons-io" % "2.20.0" % Test)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.apache.pekko.actor.typed.ActorSystem
import org.apache.pekko.actor.typed.eventstream.EventStream
import org.apache.pekko.actor.typed.scaladsl.{ ActorContext, Behaviors }
import org.apache.pekko.cluster.typed.{ Cluster, SelfUp, Subscribe }
import org.apache.pekko.persistence.cassandra.testkit.CassandraLauncher
import com.typesafe.config.{ Config, ConfigFactory }

object Main {
Expand Down Expand Up @@ -93,16 +92,15 @@ object Main {
* in a real application a pre-existing Apache Cassandra cluster should be used.
*/
def startCassandraDatabase(): Unit = {
val databaseDirectory = new File("target/cassandra-db")
CassandraLauncher.start(
databaseDirectory,
CassandraLauncher.DefaultTestConfigResource,
clean = false,
port = 9042)
import org.testcontainers.cassandra.CassandraContainer
import org.testcontainers.utility.DockerImageName
val container = new CassandraContainer(DockerImageName.parse("cassandra:5.0.5"))
// defaults to port 9042
container.start()

// shut the cassandra instance down when the JVM stops
sys.addShutdownHook {
CassandraLauncher.stop()
container.stop()
}
}

Expand Down
6 changes: 3 additions & 3 deletions pekko-sample-persistence-dc-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@
<version>${pekko-persistence-cassandra.version}</version>
</dependency>
<dependency>
<groupId>org.apache.pekko</groupId>
<artifactId>pekko-persistence-cassandra-launcher_${scala.binary.version}</artifactId>
<version>${pekko-persistence-cassandra.version}</version>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers-cassandra</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.pekko</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
import org.apache.pekko.cluster.sharding.typed.ReplicatedShardingExtension;
import org.apache.pekko.cluster.typed.Cluster;
import org.apache.pekko.management.javadsl.PekkoManagement;
import org.apache.pekko.persistence.cassandra.testkit.CassandraLauncher;
import org.apache.pekko.persistence.typed.ReplicaId;
import org.testcontainers.cassandra.CassandraContainer;
import org.testcontainers.utility.DockerImageName;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
import sample.persistence.res.counter.ThumbsUpCounter;
Expand Down Expand Up @@ -81,12 +82,13 @@ private static Config config(int port, String dc) {
* in a real application a pre-existing Cassandra cluster should be used.
*/
private static void startCassandraDatabase() {
File databaseDirectory = new File("target/cassandra-db");
CassandraLauncher.start(
databaseDirectory,
CassandraLauncher.DefaultTestConfigResource(),
false,
9042);
final CassandraContainer container = new CassandraContainer(
DockerImageName.parse("cassandra:5.0.5"));
// defaults to port 9042
container.start();

// shut the cassandra instance down when the JVM stops
Runtime.getRuntime().addShutdownHook(new Thread(() -> container.stop()));
}

}
7 changes: 1 addition & 6 deletions pekko-sample-persistence-dc-scala/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,11 @@ libraryDependencies ++= Seq(
"org.apache.pekko" %% "pekko-management" % pekkoClusterManagementVersion,
"org.apache.pekko" %% "pekko-management-cluster-http" % pekkoClusterManagementVersion,
"org.apache.pekko" %% "pekko-persistence-cassandra" % cassandraPluginVersion,
"org.apache.pekko" %% "pekko-persistence-cassandra-launcher" % cassandraPluginVersion,
"org.testcontainers" % "testcontainers-cassandra" % "2.0.1",
"ch.qos.logback" % "logback-classic" % logbackVersion,
"org.apache.pekko" %% "pekko-persistence-testkit" % pekkoVersion % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test)

// transitive dependency of akka 2.5x that is brought in by addons but evicted
dependencyOverrides += "org.apache.pekko" %% "pekko-protobuf" % pekkoVersion
dependencyOverrides += "org.apache.pekko" %% "pekko-cluster-tools" % pekkoVersion
dependencyOverrides += "org.apache.pekko" %% "pekko-coordination" % pekkoVersion

licenses := Seq(("CC0", url("http://creativecommons.org/publicdomain/zero/1.0")))

// Startup aliases for the cassandra server and for two seed nodes one for eu-west and another for eu-central
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import org.apache.pekko.actor.typed.scaladsl.Behaviors
import org.apache.pekko.cluster.sharding.typed.{ ReplicatedSharding, ReplicatedShardingExtension }
import org.apache.pekko.http.scaladsl.Http
import org.apache.pekko.management.scaladsl.PekkoManagement
import org.apache.pekko.persistence.cassandra.testkit.CassandraLauncher
import org.apache.pekko.persistence.typed.ReplicaId
import com.typesafe.config.{ Config, ConfigFactory }
import sample.persistence.res.bank.BankAccount
Expand Down Expand Up @@ -88,12 +87,16 @@ object MainApp {
* in a real application a pre-existing Cassandra cluster should be used.
*/
def startCassandraDatabase(): Unit = {
val databaseDirectory = new File("target/cassandra-db")
CassandraLauncher.start(
databaseDirectory,
CassandraLauncher.DefaultTestConfigResource,
clean = false,
port = 9042)
import org.testcontainers.cassandra.CassandraContainer
import org.testcontainers.utility.DockerImageName
val container = new CassandraContainer(DockerImageName.parse("cassandra:5.0.5"))
// defaults to port 9042
container.start()

// shut the cassandra instance down when the JVM stops
sys.addShutdownHook {
container.stop()
}
}

}