Turn on direct replication by default (#29493)
This commit is contained in:
parent
849018b81e
commit
260276fd90
4 changed files with 5 additions and 5 deletions
|
|
@ -53,7 +53,7 @@ object ReplicatedEntityProvider {
|
||||||
|
|
||||||
val typeKey = EntityTypeKey[M](s"$typeName${Separator}${replicaId.id}")
|
val typeKey = EntityTypeKey[M](s"$typeName${Separator}${replicaId.id}")
|
||||||
(settingsPerReplicaFactory(typeKey, replicaId), typeName)
|
(settingsPerReplicaFactory(typeKey, replicaId), typeName)
|
||||||
}.toVector, directReplication = false)
|
}.toVector, directReplication = true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,7 +314,7 @@ Scala
|
||||||
Java
|
Java
|
||||||
: @@snip [ReplicatedShardingTest.java](/akka-cluster-sharding-typed/src/test/java/jdocs/akka/cluster/sharding/typed/ReplicatedShardingCompileOnlySpec.java) { #bootstrap }
|
: @@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.
|
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.
|
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.
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ private[akka] final case class EventSourcedBehaviorImpl[Command, Event, State](
|
||||||
supervisionStrategy: SupervisorStrategy = SupervisorStrategy.stop,
|
supervisionStrategy: SupervisorStrategy = SupervisorStrategy.stop,
|
||||||
override val signalHandler: PartialFunction[(State, Signal), Unit] = PartialFunction.empty,
|
override val signalHandler: PartialFunction[(State, Signal), Unit] = PartialFunction.empty,
|
||||||
replication: Option[ReplicationSetup] = None,
|
replication: Option[ReplicationSetup] = None,
|
||||||
publishEvents: Boolean = false)
|
publishEvents: Boolean = true)
|
||||||
extends EventSourcedBehavior[Command, Event, State] {
|
extends EventSourcedBehavior[Command, Event, State] {
|
||||||
|
|
||||||
import EventSourcedBehaviorImpl.WriterIdentity
|
import EventSourcedBehaviorImpl.WriterIdentity
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ abstract class ReplicatedEventSourcedBehavior[Command, Event, State](
|
||||||
def this(replicationContext: ReplicationContext) = this(replicationContext, Optional.empty())
|
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.
|
* [[akka.persistence.typed.PublishedEvent]] after they have been persisted.
|
||||||
*/
|
*/
|
||||||
def withEventPublishing: Boolean = false
|
def withEventPublishing: Boolean = true
|
||||||
|
|
||||||
protected def getReplicationContext(): ReplicationContext = replicationContext
|
protected def getReplicationContext(): ReplicationContext = replicationContext
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue