parent
8b71fac817
commit
12513ec7df
13 changed files with 45 additions and 46 deletions
|
|
@ -56,7 +56,7 @@ trait ReplicatedShardingExtension extends Extension {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the sharding instances for the replicas of one replicated event sourcing entity type
|
* Represents the sharding instances for the replicas of one Replicated Event Sourcing entity type
|
||||||
*
|
*
|
||||||
* Not for user extension.
|
* Not for user extension.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ class ReplicatedShardingDirectReplicationSpec extends ScalaTestWithActorTestKit
|
||||||
replicaAProbe.expectNoMessage()
|
replicaAProbe.expectNoMessage()
|
||||||
}
|
}
|
||||||
|
|
||||||
"ignore messages not from replicated event sourcing" in {
|
"ignore messages not from Replicated Event Sourcing" in {
|
||||||
val replicaAProbe = createTestProbe[ShardingEnvelope[PublishedEvent]]()
|
val replicaAProbe = createTestProbe[ShardingEnvelope[PublishedEvent]]()
|
||||||
|
|
||||||
val replicationActor = spawn(
|
val replicationActor = spawn(
|
||||||
|
|
|
||||||
|
|
@ -1191,7 +1191,7 @@ abstract class ShardCoordinator(
|
||||||
/**
|
/**
|
||||||
* Singleton coordinator that decides where to allocate shards.
|
* Singleton coordinator that decides where to allocate shards.
|
||||||
*
|
*
|
||||||
* Users can migrate to using DData to store state then either event sourcing or ddata to store
|
* Users can migrate to using DData to store state then either Event Sourcing or ddata to store
|
||||||
* the remembered entities.
|
* the remembered entities.
|
||||||
*
|
*
|
||||||
* @see [[ClusterSharding$ ClusterSharding extension]]
|
* @see [[ClusterSharding$ ClusterSharding extension]]
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Scala
|
||||||
Java
|
Java
|
||||||
: @@snip [ClusterShardingTest.java](/akka-docs/src/test/java/jdocs/sharding/ClusterShardingTest.java) { #counter-actor }
|
: @@snip [ClusterShardingTest.java](/akka-docs/src/test/java/jdocs/sharding/ClusterShardingTest.java) { #counter-actor }
|
||||||
|
|
||||||
The above actor uses event sourcing and the support provided in @scala[`PersistentActor`] @java[`AbstractPersistentActor`] to store its state.
|
The above actor uses Event Sourcing and the support provided in @scala[`PersistentActor`] @java[`AbstractPersistentActor`] to store its state.
|
||||||
It does not have to be a persistent actor, but in case of failure or migration of entities between nodes it must be able to recover
|
It does not have to be a persistent actor, but in case of failure or migration of entities between nodes it must be able to recover
|
||||||
its state if it is valuable.
|
its state if it is valuable.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,6 @@ This means that:
|
||||||
5. `A2` can see messages from `A1` interleaved with messages from `A3`
|
5. `A2` can see messages from `A1` interleaved with messages from `A3`
|
||||||
6. Since there is no guaranteed delivery, any of the messages may be dropped, i.e. not arrive at `A2`
|
6. Since there is no guaranteed delivery, any of the messages may be dropped, i.e. not arrive at `A2`
|
||||||
|
|
||||||
|
|
||||||
@@@ note
|
@@@ note
|
||||||
|
|
||||||
It is important to note that Akka’s guarantee applies to the order in which
|
It is important to note that Akka’s guarantee applies to the order in which
|
||||||
|
|
@ -288,7 +287,7 @@ idempotent on the level of the business logic.
|
||||||
|
|
||||||
### Event Sourcing
|
### Event Sourcing
|
||||||
|
|
||||||
Event sourcing (and sharding) is what makes large websites scale to
|
Event Sourcing (and sharding) is what makes large websites scale to
|
||||||
billions of users, and the idea is quite simple: when a component (think actor)
|
billions of users, and the idea is quite simple: when a component (think actor)
|
||||||
processes a command it will generate a list of events representing the effect
|
processes a command it will generate a list of events representing the effect
|
||||||
of the command. These events are stored in addition to being applied to the
|
of the command. These events are stored in addition to being applied to the
|
||||||
|
|
@ -299,7 +298,7 @@ components may consume the event stream as a means to replicate the component’
|
||||||
state on a different continent or to react to changes). If the component’s
|
state on a different continent or to react to changes). If the component’s
|
||||||
state is lost—due to a machine failure or by being pushed out of a cache—it can
|
state is lost—due to a machine failure or by being pushed out of a cache—it can
|
||||||
be reconstructed by replaying the event stream (usually employing
|
be reconstructed by replaying the event stream (usually employing
|
||||||
snapshots to speed up the process). @ref:[Event sourcing](../typed/persistence.md#event-sourcing-concepts) is supported by
|
snapshots to speed up the process). @ref:[Event Sourcing](../typed/persistence.md#event-sourcing-concepts) is supported by
|
||||||
Akka Persistence.
|
Akka Persistence.
|
||||||
|
|
||||||
### Mailbox with Explicit Acknowledgement
|
### Mailbox with Explicit Acknowledgement
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ Java
|
||||||
|
|
||||||
## Performance and denormalization
|
## Performance and denormalization
|
||||||
|
|
||||||
When building systems using @ref:[Event sourcing](typed/persistence.md#event-sourcing-concepts) and CQRS ([Command & Query Responsibility Segregation](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/jj554200%28v=pandp.10%29)) techniques
|
When building systems using @ref:[Event Sourcing](typed/persistence.md#event-sourcing-concepts) and CQRS ([Command & Query Responsibility Segregation](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/jj554200%28v=pandp.10%29)) techniques
|
||||||
it is tremendously important to realise that the write-side has completely different needs from the read-side,
|
it is tremendously important to realise that the write-side has completely different needs from the read-side,
|
||||||
and separating those concerns into datastores that are optimised for either side makes it possible to offer the best
|
and separating those concerns into datastores that are optimised for either side makes it possible to offer the best
|
||||||
experience for the write and read sides independently.
|
experience for the write and read sides independently.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
---
|
---
|
||||||
project.description: Akka Persistence Classic, event sourcing with Akka, At-Least-Once delivery, snapshots, recovery and replay with Akka actors.
|
project.description: Akka Persistence Classic, Event Sourcing with Akka, At-Least-Once delivery, snapshots, recovery and replay with Akka actors.
|
||||||
---
|
---
|
||||||
# Classic Persistence
|
# Classic Persistence
|
||||||
|
|
||||||
|
|
@ -44,12 +44,12 @@ Replicated journals are available as [Community plugins](https://akka.io/communi
|
||||||
* *Snapshot store*: A snapshot store persists snapshots of a persistent actor's state. Snapshots are
|
* *Snapshot store*: A snapshot store persists snapshots of a persistent actor's state. Snapshots are
|
||||||
used for optimizing recovery times. The storage backend of a snapshot store is pluggable.
|
used for optimizing recovery times. The storage backend of a snapshot store is pluggable.
|
||||||
The persistence extension comes with a "local" snapshot storage plugin, which writes to the local filesystem. Replicated snapshot stores are available as [Community plugins](https://akka.io/community/)
|
The persistence extension comes with a "local" snapshot storage plugin, which writes to the local filesystem. Replicated snapshot stores are available as [Community plugins](https://akka.io/community/)
|
||||||
* *Event sourcing*. Based on the building blocks described above, Akka persistence provides abstractions for the
|
* *Event Sourcing*. Based on the building blocks described above, Akka persistence provides abstractions for the
|
||||||
development of event sourced applications (see section @ref:[Event sourcing](typed/persistence.md#event-sourcing-concepts)).
|
development of event sourced applications (see section @ref:[Event Sourcing](typed/persistence.md#event-sourcing-concepts)).
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
Akka persistence supports event sourcing with the @scala[`PersistentActor` trait]@java[`AbstractPersistentActor` abstract class]. An actor that extends this @scala[trait]@java[class] uses the
|
Akka persistence supports Event Sourcing with the @scala[`PersistentActor` trait]@java[`AbstractPersistentActor` abstract class]. An actor that extends this @scala[trait]@java[class] uses the
|
||||||
`persist` method to persist and handle events. The behavior of @scala[a `PersistentActor`]@java[an `AbstractPersistentActor`]
|
`persist` method to persist and handle events. The behavior of @scala[a `PersistentActor`]@java[an `AbstractPersistentActor`]
|
||||||
is defined by implementing @scala[`receiveRecover`]@java[`createReceiveRecover`] and @scala[`receiveCommand`]@java[`createReceive`]. This is demonstrated in the following example.
|
is defined by implementing @scala[`receiveRecover`]@java[`createReceiveRecover`] and @scala[`receiveCommand`]@java[`createReceive`]. This is demonstrated in the following example.
|
||||||
|
|
||||||
|
|
@ -453,7 +453,7 @@ timer-based which keeps latencies at a minimum.
|
||||||
It is possible to delete all messages (journaled by a single persistent actor) up to a specified sequence number;
|
It is possible to delete all messages (journaled by a single persistent actor) up to a specified sequence number;
|
||||||
Persistent actors may call the `deleteMessages` method to this end.
|
Persistent actors may call the `deleteMessages` method to this end.
|
||||||
|
|
||||||
Deleting messages in event sourcing based applications is typically either not used at all, or used in conjunction with
|
Deleting messages in Event Sourcing based applications is typically either not used at all, or used in conjunction with
|
||||||
[snapshotting](#snapshots), i.e. after a snapshot has been successfully stored, a `deleteMessages(toSequenceNr)`
|
[snapshotting](#snapshots), i.e. after a snapshot has been successfully stored, a `deleteMessages(toSequenceNr)`
|
||||||
up until the sequence number of the data held by that snapshot can be issued to safely delete the previous events
|
up until the sequence number of the data held by that snapshot can be issued to safely delete the previous events
|
||||||
while still having access to the accumulated state during replays - by loading the snapshot.
|
while still having access to the accumulated state during replays - by loading the snapshot.
|
||||||
|
|
@ -750,7 +750,7 @@ configuration key. The method can be overridden by implementation classes to ret
|
||||||
|
|
||||||
## Event Adapters
|
## Event Adapters
|
||||||
|
|
||||||
In long running projects using event sourcing sometimes the need arises to detach the data model from the domain model
|
In long running projects using Event Sourcing sometimes the need arises to detach the data model from the domain model
|
||||||
completely.
|
completely.
|
||||||
|
|
||||||
Event Adapters help in situations where:
|
Event Adapters help in situations where:
|
||||||
|
|
|
||||||
|
|
@ -388,7 +388,7 @@ Links to reference documentation:
|
||||||
|
|
||||||
The correspondence of the classic `PersistentActor` is @scala[`akka.persistence.typed.scaladsl.EventSourcedBehavior`]@java[`akka.persistence.typed.javadsl.EventSourcedBehavior`].
|
The correspondence of the classic `PersistentActor` is @scala[`akka.persistence.typed.scaladsl.EventSourcedBehavior`]@java[`akka.persistence.typed.javadsl.EventSourcedBehavior`].
|
||||||
|
|
||||||
The Typed API is much more guided to facilitate event sourcing best practises. It also has tighter integration with
|
The Typed API is much more guided to facilitate Event Sourcing best practices. It also has tighter integration with
|
||||||
Cluster Sharding.
|
Cluster Sharding.
|
||||||
|
|
||||||
Links to reference documentation:
|
Links to reference documentation:
|
||||||
|
|
|
||||||
|
|
@ -103,9 +103,9 @@ Java
|
||||||
|
|
||||||
## Event deletion
|
## Event deletion
|
||||||
|
|
||||||
Deleting events in event sourcing based applications is typically either not used at all, or used in conjunction with snapshotting.
|
Deleting events in Event Sourcing based applications is typically either not used at all, or used in conjunction with snapshotting.
|
||||||
By deleting events you will lose the history of how the system changed before it reached current state, which is
|
By deleting events you will lose the history of how the system changed before it reached current state, which is
|
||||||
one of the main reasons for using event sourcing in the first place.
|
one of the main reasons for using Event Sourcing in the first place.
|
||||||
|
|
||||||
If snapshot-based retention is enabled, after a snapshot has been successfully stored, a delete of the events
|
If snapshot-based retention is enabled, after a snapshot has been successfully stored, a delete of the events
|
||||||
(journaled by a single event sourced actor) up until the sequence number of the data held by that snapshot can be issued.
|
(journaled by a single event sourced actor) up until the sequence number of the data held by that snapshot can be issued.
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ provides tools to facilitate in building GDPR capable systems.
|
||||||
|
|
||||||
@@@
|
@@@
|
||||||
|
|
||||||
### Event sourcing concepts
|
### Event Sourcing concepts
|
||||||
|
|
||||||
See an [introduction to Event Sourcing](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/jj591559%28v=pandp.10%29) at MSDN.
|
See an [introduction to Event Sourcing](https://docs.microsoft.com/en-us/previous-versions/msp-n-p/jj591559%28v=pandp.10%29) at MSDN.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ warning or deprecation period. It is also not recommended to use this module in
|
||||||
|
|
||||||
@@@
|
@@@
|
||||||
|
|
||||||
@ref[Event sourcing](./persistence.md) with `EventSourcedBehavior`s is based on the single writer principle, which means that there can only be one active instance of a `EventSourcedBehavior`
|
@ref[Event Sourcing](./persistence.md) with `EventSourcedBehavior`s is based on the single writer principle, which means that there can only be one active instance of a `EventSourcedBehavior`
|
||||||
with a given `persistenceId`. Otherwise, multiple instances would store interleaving events based on different states, and when these events would later be replayed it would not be possible to reconstruct the correct state.
|
with a given `persistenceId`. Otherwise, multiple instances would store interleaving events based on different states, and when these events would later be replayed it would not be possible to reconstruct the correct state.
|
||||||
|
|
||||||
This restriction means that in the event of network partitions, and for a short time during rolling re-deploys, some
|
This restriction means that in the event of network partitions, and for a short time during rolling re-deploys, some
|
||||||
|
|
@ -421,7 +421,7 @@ For a snapshot plugin to support replication it needs to store and read metadata
|
||||||
To attach the metadata when reading the snapshot the `akka.persistence.SnapshotMetadata.apply` factory overload taking a `metadata` parameter is used.
|
To attach the metadata when reading the snapshot the `akka.persistence.SnapshotMetadata.apply` factory overload taking a `metadata` parameter is used.
|
||||||
The @apidoc[SnapshotStoreSpec] in the Persistence TCK provides a capability flag `supportsMetadata` to toggle verification that metadata is handled correctly.
|
The @apidoc[SnapshotStoreSpec] in the Persistence TCK provides a capability flag `supportsMetadata` to toggle verification that metadata is handled correctly.
|
||||||
|
|
||||||
The following plugins support replicated event sourcing:
|
The following plugins support Replicated Event Sourcing:
|
||||||
|
|
||||||
* [Akka Persistence Cassandra](https://doc.akka.io/docs/akka-persistence-cassandra/current/index.html) versions 1.0.3+
|
* [Akka Persistence Cassandra](https://doc.akka.io/docs/akka-persistence-cassandra/current/index.html) versions 1.0.3+
|
||||||
* [Akka Persistence Spanner](https://doc.akka.io/docs/akka-persistence-spanner/current/overview.html) versions 1.0.0-RC4+
|
* [Akka Persistence Spanner](https://doc.akka.io/docs/akka-persistence-spanner/current/overview.html) versions 1.0.0-RC4+
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import akka.util.JavaDurationConverters._
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [[DurableProducerQueue]] that can be used with [[akka.actor.typed.delivery.ProducerController]]
|
* [[DurableProducerQueue]] that can be used with [[akka.actor.typed.delivery.ProducerController]]
|
||||||
* for reliable delivery of messages. It is implemented with event sourcing and stores one
|
* for reliable delivery of messages. It is implemented with Event Sourcing and stores one
|
||||||
* event before sending the message to the destination and one event for the confirmation
|
* event before sending the message to the destination and one event for the confirmation
|
||||||
* that the message has been delivered and processed.
|
* that the message has been delivered and processed.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ final class DiscardConfigurator extends StashOverflowStrategyConfigurator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scala API: A persistent Actor - can be used to implement command or event sourcing.
|
* Scala API: A persistent Actor - can be used to implement command or Event Sourcing.
|
||||||
*/
|
*/
|
||||||
trait PersistentActor extends Eventsourced with PersistenceIdentity {
|
trait PersistentActor extends Eventsourced with PersistenceIdentity {
|
||||||
def receive = receiveCommand
|
def receive = receiveCommand
|
||||||
|
|
@ -290,7 +290,7 @@ trait PersistentActor extends Eventsourced with PersistenceIdentity {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Java API: an persistent actor - can be used to implement command or event sourcing.
|
* Java API: an persistent actor - can be used to implement command or Event Sourcing.
|
||||||
*/
|
*/
|
||||||
abstract class AbstractPersistentActor extends AbstractActor with AbstractPersistentActorLike {
|
abstract class AbstractPersistentActor extends AbstractActor with AbstractPersistentActorLike {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue