This is an automated email from the ASF dual-hosted git repository.
philippus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-connectors-kafka.git
The following commit(s) were added to refs/heads/main by this push:
new a8143043 Use new ExternalShardAllocationStrategy api in examples (#509)
a8143043 is described below
commit a814304399a3bf91cd8d5480518551a34268fca6
Author: Philippus Baalman <[email protected]>
AuthorDate: Thu Apr 16 15:07:39 2026 +0200
Use new ExternalShardAllocationStrategy api in examples (#509)
---
java-tests/src/test/java/docs/javadsl/ClusterShardingExample.java | 5 ++---
tests/src/test/scala/docs/scaladsl/ClusterShardingExample.scala | 2 +-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/java-tests/src/test/java/docs/javadsl/ClusterShardingExample.java
b/java-tests/src/test/java/docs/javadsl/ClusterShardingExample.java
index e79330f0..b8fb9361 100644
--- a/java-tests/src/test/java/docs/javadsl/ClusterShardingExample.java
+++ b/java-tests/src/test/java/docs/javadsl/ClusterShardingExample.java
@@ -35,7 +35,6 @@ import
org.apache.pekko.kafka.cluster.sharding.KafkaClusterSharding;
import org.apache.pekko.kafka.javadsl.Consumer;
import org.apache.pekko.stream.javadsl.Flow;
import org.apache.pekko.stream.javadsl.Sink;
-import org.apache.pekko.util.Timeout;
public class ClusterShardingExample {
@@ -87,8 +86,8 @@ public class ClusterShardingExample {
.init(
Entity.of(typeKey, ctx -> userBehaviour())
.withAllocationStrategy(
- new ExternalShardAllocationStrategy(
- system, typeKey.name(),
Timeout.create(Duration.ofSeconds(5))))
+ ExternalShardAllocationStrategy.create(
+ system, typeKey.name(), Duration.ofSeconds(5)))
.withMessageExtractor(extractor)));
// #setup-cluster-sharding
diff --git a/tests/src/test/scala/docs/scaladsl/ClusterShardingExample.scala
b/tests/src/test/scala/docs/scaladsl/ClusterShardingExample.scala
index b69c150f..0126bb06 100644
--- a/tests/src/test/scala/docs/scaladsl/ClusterShardingExample.scala
+++ b/tests/src/test/scala/docs/scaladsl/ClusterShardingExample.scala
@@ -71,7 +71,7 @@ object ClusterShardingExample {
case Success(extractor) =>
ClusterSharding(system).init(
Entity(typeKey)(createBehavior = _ => userBehaviour())
- .withAllocationStrategy(new ExternalShardAllocationStrategy(system,
typeKey.name))
+ .withAllocationStrategy(ExternalShardAllocationStrategy(system,
typeKey.name, 5.seconds))
.withMessageExtractor(extractor)
.withSettings(ClusterShardingSettings(system)))
case Failure(ex) => system.log.error("An error occurred while obtaining
the message extractor", ex)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]