Turn on direct replication by default (#29493)

This commit is contained in:
Christopher Batey 2020-08-14 12:26:54 +01:00
parent 849018b81e
commit 260276fd90
4 changed files with 5 additions and 5 deletions

View file

@ -53,7 +53,7 @@ object ReplicatedEntityProvider {
val typeKey = EntityTypeKey[M](s"$typeName${Separator}${replicaId.id}")
(settingsPerReplicaFactory(typeKey, replicaId), typeName)
}.toVector, directReplication = false)
}.toVector, directReplication = true)
}
}

View file

@ -314,7 +314,7 @@ Scala
Java
: @@snip [ReplicatedShardingTest.java](/akka-cluster-sharding-typed/src/test/java/jdocs/akka/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.java) { #bootstrap }
This will run a single instance of sharding and the replicas will be differentiated by having the replica id in the sharding entity id.
This will run an instance of sharding and per replica and each entity id contains the replica id and the type name.
Replicas could be on the same node if they end up in the same shard or if the shards get allocated to the same node.
To prevent this roles can be used. You could for instance add a cluster role per availability zone / rack and have a replica per rack.

View file

@ -98,7 +98,7 @@ private[akka] final case class EventSourcedBehaviorImpl[Command, Event, State](
supervisionStrategy: SupervisorStrategy = SupervisorStrategy.stop,
override val signalHandler: PartialFunction[(State, Signal), Unit] = PartialFunction.empty,
replication: Option[ReplicationSetup] = None,
publishEvents: Boolean = false)
publishEvents: Boolean = true)
extends EventSourcedBehavior[Command, Event, State] {
import EventSourcedBehaviorImpl.WriterIdentity

View file

@ -25,10 +25,10 @@ abstract class ReplicatedEventSourcedBehavior[Command, Event, State](
def this(replicationContext: ReplicationContext) = this(replicationContext, Optional.empty())
/**
* Override and return true to publish events to the system event stream as
* Override and return false to disable events being published to the system event stream as
* [[akka.persistence.typed.PublishedEvent]] after they have been persisted.
*/
def withEventPublishing: Boolean = false
def withEventPublishing: Boolean = true
protected def getReplicationContext(): ReplicationContext = replicationContext