* Deferred events are not persisted, thus will not participate in replays
etc. If users want events to be persisted, they can simply use
`persistAsync` instead.
* This, 3rd, rewrite extends the Persistent hierarchy by a top level
trait "Resequenceable", which is used to mark every event to be sent
in sequence back to the PersistentActor. These are split into
NonPersistentRepr or PersistentRepr, and acted upon accordingly.
* defer is guaranteed to be called, even after persistence failures
* Includes docs updates for java/scala/java8
Resolves#15229
Depends on #15227
Conflicts:
akka-docs/rst/scala/code/docs/persistence/PersistenceDocSpec.scala
akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
akka-persistence/src/main/scala/akka/persistence/Processor.scala
akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
project/AkkaBuild.scala
Breaks binary compatibility because adding new methods to Eventsourced
trait. Since akka-persistence is experimental this is ok, yet
source-level compatibility has been perserved thankfuly :-)
Deprecates:
* Rename of EventsourcedProcessor -> PersistentActor
* Processor -> suggest using PersistentActor
* Migration guide for akka-persistence is separate, as wel'll deprecate in minor versions (its experimental)
* Persistent as well as ConfirmablePersistent - since Processor, their
main user will be removed soon.
Other changes:
* persistAsync works as expected when mixed with persist
* A counter must be kept for pending stashing invocations
* Uses only 1 shared list buffer for persit / persistAsync
* Includes small benchmark
* Docs also include info about not using Persistent() wrapper
* uses java LinkedList, for best performance of append / head on
persistInvocations; the get(0) is safe, because these msgs only
come in response to persistInvocations
* Renamed internal *MessagesSuccess/Failure messages because we kept
small mistakes seeing the class "with s" and "without s" as the same
* Updated everything that refered to EventsourcedProcessor to
PersistentActor, including samples
Refs #15227
Conflicts:
akka-docs/rst/project/migration-guides.rst
akka-persistence/src/main/scala/akka/persistence/JournalProtocol.scala
akka-persistence/src/main/scala/akka/persistence/Persistent.scala
akka-persistence/src/test/scala/akka/persistence/PersistentActorSpec.scala
project/AkkaBuild.scala
* afterAll not called when all tests marked as ignore,
invokeBeforeAllAndAfterAllEvenIfNoTestsAreExpected = true
should solve that, but changed to pending in Ticket1978 anyway
* Try to shutdown when ActorSystem init fails. It is difficult
to cover all scenarios, but this should improve the situation.
This was the reason why DeployerSpec leaked.
* missing shutdown in some tests
- Built-in redelivery mechanism for Channel and PersistentChannel
- redelivery counter on ConfirmablePersistent
- redeliveries out of initial message delivery order
- relative order of redelivered messages is preserved
- configurable redelivery policy (ChannelSettings)
- Major refactorings of channels (and channel tests)
- Throughput load test for PersistentChannel
Todo:
- Paged/throtlled replay (another pull request)
- Resequencer (another pull request)
- internal batching of individually received Persistent messages
- testing fault tolerance of Processor in presence of random
* journaling failures
* processing failures
- single and bulk deletion of messages
- single and bulk deletion of snapshots
- run journal and snapshot store as system actors
- rename physical parameter in delete methods to permanent
- StashSupport.prepend docs and implementation enhancements
- Persistent channel
- ConfirmablePersistent message type delivered by channel
- Sender resolution performance improvements
* unstash() instead of unstashAll()
These enhancements required the following changes
- Unified implementation of processor stash and user stash
- Persistence message plugin API separated from implementation
- Physical deletion of messages
- batch-write of persistent messages (user API)
- batch-write of events (in EventsourcedProcessor)
- command processing in EventsourcedProcessor by unstashing messages one-by-one from the internal stash
* fixes performance issues that come up with unstashAll
- commands are not looped through journal actor but processed directly
- initial performance tests
* command sourcing
* event sourcing
* event sourcing with user stash operations
- suppress stack traces in tests
- Journal plugin API for storage backends with asynchronous client API (default impl: in-memory journal)
- Journal plugin API for storage backends with synchronous client API (default impl: LevelDB journal)
- Snapshot store plugin API (default impl: local filesystem snapshot store)
- capture and save snapshots of processor state
- start processor recovery from saved snapshots
- snapshot storage on local filesystem
- snapshot store completely isolated from journal
- LevelDB journal modularized (and completely re-rwritten)
- In-memory journal removed
- introduce around life cycle hooks for symmetry with aroundReceive
- no custom processor-specific life cycle hooks needed any more
- preStart and preRestart can be overridden with empty implementation
(interceptors ensure that super.preXxx calls are still executed)
- all around life cycle hooks can be final
- standard life cycle hooks are non-final to preserve composability with existing traits (FSM, ...)
The most prominent changes compared to eventsourced are:
- No central processor and channel registry any more
- Auto-recovery of processors on start and restart (can be disabled)
- Recovery of processor networks doesn't require coordination
- Explicit channel activation not needed any more
- Message sequence numbers generated per processor (no gaps)
- Sender references are journaled along with messages
- Processors can determine their recovery status
- No custom API on extension object, only messages
- Journal created by extension from config, not by application
- Applications only interact with processors and channels via messages
- Internal design prepared for having processor-specific journal actors (for later optimization possibilities)
Further additions and changes during review:
- Allow processor implementation classes to use inherited stash
- Channel support to resolve (potentially invalid) sender references
- Logical intead of physical deletion of messages
- Pinned dispatcher for LevelDB journal
- Processor can handle failures during recovery
- Message renamed to Persistent
This prototype has the following limitations:
- Serialization of persistent messages and their payload via JavaSerializer only (will be configurable later)
- The LevelDB journal implementation based on a LevelDB Java port, not the native LevelDB (will be configurable later)
The following features will be added later using separate tickets:
- Snapshot-based recovery
- Reliable channels
- Journal plugin API
- Optimizations
- ...