Class ShardingDirectReplication
- java.lang.Object
-
- org.apache.pekko.cluster.sharding.typed.ShardingDirectReplication
-
public class ShardingDirectReplication extends java.lang.Object
INTERNAL APIUsed when sharding Replicated Event Sourced entities in multiple instances of sharding, for example one per DC in a Multi DC Pekko Cluster.
This actor should be started once on each node where Replicated Event Sourced entities will run (the same nodes that you start sharding on). The entities should be set up with
pekko.persistence.typed.scaladsl.EventSourcedBehavior.withEventPublishing
orpekko.persistence.typed.javadsl.ReplicatedEventSourcedBehavior#withEventPublishing()
If usingReplicatedSharding
the replication can be enabled throughReplicatedEntityProvider.withDirectReplication
instead of starting this actor manually.Subscribes to locally written events through the event stream and sends the seen events to all the sharded replicas which can then fast forward their cross-replica event streams to improve latency while allowing less frequent poll for the cross replica queries. Note that since message delivery is at-most-once this can not be the only channel for replica events - the entities must still tail events from the journals of other replicas.
The events are forwarded as
pekko.cluster.sharding.typed.ShardingEnvelope
this will work out of the box both by default and with a custom extractor since the envelopes are handled internally.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ShardingDirectReplication.Command
Not for user extensionstatic class
ShardingDirectReplication.VerifyStarted$
-
Constructor Summary
Constructors Constructor Description ShardingDirectReplication()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Behavior<ShardingDirectReplication.Command>
apply(java.lang.String typeName, scala.Option<ReplicaId> selfReplica, scala.collection.immutable.Map<ReplicaId,ActorRef<T>> replicaShardingProxies)
-
-
-
Method Detail
-
apply
public static <T> Behavior<ShardingDirectReplication.Command> apply(java.lang.String typeName, scala.Option<ReplicaId> selfReplica, scala.collection.immutable.Map<ReplicaId,ActorRef<T>> replicaShardingProxies)
-
-