!per #15428 Deprecate deleteMessage

(cherry picked from commit 4973d0b37d635a0a2c9a94c2898da988e4f14fc7)
This commit is contained in:
Patrik Nordwall 2014-06-27 08:10:20 +02:00
parent 018e0c33b5
commit 07e67b90ea
5 changed files with 31 additions and 17 deletions

View file

@ -255,12 +255,13 @@ single command).
Message deletion
----------------
A persistent actor can delete a single message by calling the ``deleteMessage`` method with the sequence number of
that message as argument. An optional ``permanent`` parameter specifies whether the message shall be permanently
To delete all messages (journaled by a single persistent actor) up to a specified sequence number,
persistent actors may call the ``deleteMessages`` method.
An optional ``permanent`` parameter specifies whether the message shall be permanently
deleted from the journal or only marked as deleted. In both cases, the message won't be replayed. Later extensions
to Akka persistence will allow to replay messages that have been marked as deleted which can be useful for debugging
purposes, for example. To delete all messages (journaled by a single persistent actor) up to a specified sequence number,
persistent actors should call the ``deleteMessages`` method.
purposes, for example.
.. _persistent-views-java-lambda:

View file

@ -261,12 +261,13 @@ single command).
Message deletion
----------------
A persistent actor can delete a single message by calling the ``deleteMessage`` method with the sequence number of
that message as argument. An optional ``permanent`` parameter specifies whether the message shall be permanently
To delete all messages (journaled by a single persistent actor) up to a specified sequence number,
persistent actors may call the ``deleteMessages`` method.
An optional ``permanent`` parameter specifies whether the message shall be permanently
deleted from the journal or only marked as deleted. In both cases, the message won't be replayed. Later extensions
to Akka persistence will allow to replay messages that have been marked as deleted which can be useful for debugging
purposes, for example. To delete all messages (journaled by a single persistent actor) up to a specified sequence number,
persistent actors should call the ``deleteMessages`` method.
purposes, for example.
.. _persistent-views-java:

View file

@ -1,8 +1,8 @@
.. _migration-guide-persistence-experimental-2.3.x-2.4.x:
#####################################################
Migration Guide Akka Persistence (experimental) 2.3.3
#####################################################
##########################################################################
Migration Guide Akka Persistence (experimental) 2.3.3 to 2.3.4 (and 2.4.x)
##########################################################################
**Akka Persistence** is an **experimental module**, which means that neither Binary Compatibility nor API stability
is provided for Persistence while under the *experimental* flag. The goal of this phase is to gather user feedback
@ -122,6 +122,17 @@ Using the``PersistentActor`` instead of ``Processor`` also shifts the responsibi
to the receiver instead of the sender of the message. Previously, using ``Processor``, clients would have to wrap messages as ``Persistent(cmd)``
manually, as well as have to be aware of the receiver being a ``Processor``, which didn't play well with transparency of the ActorRefs in general.
Removed deleteMessage
=====================
``deleteMessage`` is deprecated and will be removed. When using command sourced ``Processor`` the command was stored before it was
received and could be validated and then there was a reason to remove faulty commands to avoid repeating the error during replay.
When using ``PersistentActor`` you can always validate the command before persisting and therefore the stored event (or command)
should always be valid for replay.
``deleteMessages`` can still be used for pruning of all messages up to a sequence number.
Renamed View to PersistentView, which receives plain messages (Persistent() wrapper is gone)
============================================================================================
Views used to receive messages wrapped as ``Persistent(payload, seqNr)``, this is no longer the case and views receive

View file

@ -257,14 +257,13 @@ single command).
Message deletion
----------------
A persistent actor can delete a single message by calling the ``deleteMessage`` method with the sequence number of
that message as argument. An optional ``permanent`` parameter specifies whether the message shall be permanently
To delete all messages (journaled by a single persistent actor) up to a specified sequence number,
persistent actors may call the ``deleteMessages`` method.
An optional ``permanent`` parameter specifies whether the message shall be permanently
deleted from the journal or only marked as deleted. In both cases, the message won't be replayed. Later extensions
to Akka persistence will allow to replay messages that have been marked as deleted which can be useful for debugging
purposes, for example. To delete all messages (journaled by a single persistent actor) up to a specified sequence number,
persistent actors should call the ``deleteMessages`` method.
purposes, for example.
.. _persistent-views:

View file

@ -205,6 +205,7 @@ private[akka] trait ProcessorImpl extends Actor with Recovery {
*
* @param sequenceNr sequence number of the persistent message to be deleted.
*/
@deprecated("deleteMessage(sequenceNr) will be removed. Instead, validate before persist, and use deleteMessages for pruning.", since = "2.3.4")
def deleteMessage(sequenceNr: Long): Unit = {
deleteMessage(sequenceNr, permanent = false)
}
@ -220,6 +221,7 @@ private[akka] trait ProcessorImpl extends Actor with Recovery {
* @param sequenceNr sequence number of the persistent message to be deleted.
* @param permanent if `false`, the message is marked as deleted, otherwise it is permanently deleted.
*/
@deprecated("deleteMessage(sequenceNr) will be removed. Instead, validate before persist, and use deleteMessages for pruning.", since = "2.3.4")
def deleteMessage(sequenceNr: Long, permanent: Boolean): Unit = {
journal ! DeleteMessages(List(PersistenceIdImpl(persistenceId, sequenceNr)), permanent)
}