final class EventSourcedCleanup extends AnyRef
Java API: Tool for deleting or setting expiration (time to live) of events and/or snapshots for a given list of
persistenceIds
without using persistent actors.
When running an operation with EventSourcedCleanup
that deletes all events for a persistence id, the actor with
that persistence id must not be running! If the actor is restarted it would in that case be recovered to the wrong
state since the stored events have been deleted. Delete events before snapshot can still be used while the actor is
running.
If resetSequenceNumber
is true
then an entity created with the same persistenceId
will start from 0. Otherwise
it will continue from the latest highest used sequence number.
WARNING: reusing the same persistenceId
after resetting the sequence number should be avoided, since it might be
confusing to reuse the same sequence number for new events.
When a list of persistenceIds
are given, they are deleted sequentially in the same order as the list. It's possible
to parallelize the deletes by running several cleanup operations at the same time, each operating on different sets
of persistenceIds
.
- Annotations
- @ApiMayChange()
- Alphabetic
- By Inheritance
- EventSourcedCleanup
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new EventSourcedCleanup(systemProvider: ClassicActorSystemProvider)
- new EventSourcedCleanup(systemProvider: ClassicActorSystemProvider, configPath: String)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def cleanupBeforeSnapshot(persistenceIds: List[String]): CompletionStage[Done]
See single persistenceId overload for what is done for each persistence id.
See single persistenceId overload for what is done for each persistence id.
- persistenceIds
the persistence ids to delete for
- def cleanupBeforeSnapshot(persistenceId: String): CompletionStage[Done]
Deletes all events for the given persistence id from before the snapshot.
Deletes all events for the given persistence id from before the snapshot. The snapshot is not deleted. The event with the same sequence number as the remaining snapshot is deleted.
- persistenceId
the persistence id to delete for
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def deleteAll(persistenceIds: List[String], resetSequenceNumber: Boolean): CompletionStage[Done]
Delete everything related to the given list of
persistenceIds
.Delete everything related to the given list of
persistenceIds
. All events and snapshots are deleted.- persistenceIds
the persistence ids to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- def deleteAll(persistenceId: String, resetSequenceNumber: Boolean): CompletionStage[Done]
Delete everything related to one single
persistenceId
.Delete everything related to one single
persistenceId
. All events and snapshots are deleted.- persistenceId
the persistence id to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- def deleteAllEvents(persistenceIds: List[String], resetSequenceNumber: Boolean): CompletionStage[Done]
Delete all events related to the given list of
persistenceIds
.Delete all events related to the given list of
persistenceIds
. Snapshots are not deleted.- persistenceIds
the persistence ids to delete for
- resetSequenceNumber
whether the entities will start from zero again, or continue from highest sequence number
- def deleteAllEvents(persistenceId: String, resetSequenceNumber: Boolean): CompletionStage[Done]
Delete all events related to one single
persistenceId
.Delete all events related to one single
persistenceId
. Snapshots are not deleted.- persistenceId
the persistence id to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- def deleteEventsTo(persistenceId: String, toSequenceNr: Long): CompletionStage[Done]
Delete all events before a sequenceNr for the given persistence id.
Delete all events before a sequenceNr for the given persistence id. Snapshots are not deleted.
- persistenceId
the persistence id to delete for
- toSequenceNr
sequence nr (inclusive) to delete up to
- def deleteSnapshot(persistenceId: String): CompletionStage[Done]
Delete snapshots related to one single
persistenceId
.Delete snapshots related to one single
persistenceId
. Events are not deleted.- persistenceId
the persistence id to delete for
- def deleteSnapshots(persistenceIds: List[String]): CompletionStage[Done]
Delete all snapshots related to the given list of
persistenceIds
.Delete all snapshots related to the given list of
persistenceIds
. Events are not deleted.- persistenceIds
the persistence ids to delete for
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def setExpiryForAllEvents(persistenceIds: List[String], resetSequenceNumber: Boolean, timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for all events related to the given list of
persistenceIds
.Set expiry (time to live) for all events related to the given list of
persistenceIds
. Snapshots do not have expiry set.- persistenceIds
the persistence ids to delete for
- resetSequenceNumber
whether the entities will start from zero again, or continue from highest sequence number
- timeToLive
time-to-live duration from now
- def setExpiryForAllEvents(persistenceIds: List[String], resetSequenceNumber: Boolean, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for all events related to the given list of
persistenceIds
.Set expiry (time to live) for all events related to the given list of
persistenceIds
. Snapshots do not have expiry set.- persistenceIds
the persistence ids to delete for
- resetSequenceNumber
whether the entities will start from zero again, or continue from highest sequence number
- expiryTimestamp
expiration timestamp to set on all events
- def setExpiryForAllEvents(persistenceId: String, resetSequenceNumber: Boolean, timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for all events related to a single persistence id.
Set expiry (time to live) for all events related to a single persistence id. Snapshots do not have expiry set.
- persistenceId
the persistence id to set expiry for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- timeToLive
time-to-live duration from now
- def setExpiryForAllEvents(persistenceId: String, resetSequenceNumber: Boolean, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for all events related to a single persistence id.
Set expiry (time to live) for all events related to a single persistence id. Snapshots do not have expiry set.
- persistenceId
the persistence id to set expiry for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- expiryTimestamp
expiration timestamp to set on all events
- def setExpiryForAllEventsAndSnapshot(persistenceId: String, resetSequenceNumber: Boolean, timeToLive: Duration): CompletionStage[Done]
Set expiry for everything related to a single persistence id.
Set expiry for everything related to a single persistence id. All events and the snapshot have expiry set.
- persistenceId
the persistence id to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- timeToLive
time-to-live duration from now
- def setExpiryForAllEventsAndSnapshot(persistenceId: String, resetSequenceNumber: Boolean, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry for everything related to a single persistence id.
Set expiry for everything related to a single persistence id. All events and the snapshot have expiry set.
- persistenceId
the persistence id to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- expiryTimestamp
expiration timestamp to set on all events before snapshot
- def setExpiryForAllEventsAndSnapshots(persistenceIds: List[String], resetSequenceNumber: Boolean, timeToLive: Duration): CompletionStage[Done]
Set expiry for everything related to the given persistence ids.
Set expiry for everything related to the given persistence ids. All events and snapshots have expiry set.
- persistenceIds
the persistence ids to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- timeToLive
time-to-live duration from now
- def setExpiryForAllEventsAndSnapshots(persistenceIds: List[String], resetSequenceNumber: Boolean, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry for everything related to the given persistence ids.
Set expiry for everything related to the given persistence ids. All events and snapshots have expiry set.
- persistenceIds
the persistence ids to delete for
- resetSequenceNumber
whether the entity will start from zero again, or continue from highest sequence number
- expiryTimestamp
expiration timestamp to set on all events before snapshot
- def setExpiryForEvents(persistenceId: String, toSequenceNr: Long, timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for all events up to a sequence number for the given persistence id.
Set expiry (time to live) for all events up to a sequence number for the given persistence id. Snapshots do not have expiry set.
- persistenceId
the persistence id to set expiry for
- toSequenceNr
sequence number (inclusive) to set expiry
- timeToLive
time-to-live duration from now
- def setExpiryForEvents(persistenceId: String, toSequenceNr: Long, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for all events up to a sequence number for the given persistence id.
Set expiry (time to live) for all events up to a sequence number for the given persistence id. Snapshots do not have expiry set.
- persistenceId
the persistence id to set expiry for
- toSequenceNr
sequence number (inclusive) to set expiry
- expiryTimestamp
expiration timestamp to set on selected events
- def setExpiryForEventsBeforeSnapshot(persistenceId: String, timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for all events for the given persistence id from before its snapshot.
Set expiry (time to live) for all events for the given persistence id from before its snapshot. The snapshot does not have expiry set. The event with the same sequence number as the snapshot does have expiry set.
- persistenceId
the persistence id to set expiry for
- timeToLive
time-to-live duration from now
- def setExpiryForEventsBeforeSnapshot(persistenceId: String, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for all events for the given persistence id from before its snapshot.
Set expiry (time to live) for all events for the given persistence id from before its snapshot. The snapshot does not have expiry set. The event with the same sequence number as the snapshot does have expiry set.
- persistenceId
the persistence id to set expiry for
- expiryTimestamp
expiration timestamp to set on all events before snapshot
- def setExpiryForEventsBeforeSnapshots(persistenceIds: List[String], timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for all events for the given persistence ids from before their snapshots.
Set expiry (time to live) for all events for the given persistence ids from before their snapshots. The snapshots do not have expiry set. The events with the same sequence number as the snapshots do have expiry set.
- persistenceIds
the persistence ids to set expiry for
- timeToLive
time-to-live duration from now
- def setExpiryForEventsBeforeSnapshots(persistenceIds: List[String], expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for all events for the given persistence ids from before their snapshots.
Set expiry (time to live) for all events for the given persistence ids from before their snapshots. The snapshots do not have expiry set. The events with the same sequence number as the snapshots do have expiry set.
- persistenceIds
the persistence ids to set expiry for
- expiryTimestamp
expiration timestamp to set on all events before snapshot
- def setExpiryForSnapshot(persistenceId: String, timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for the snapshot related to a single persistence id.
Set expiry (time to live) for the snapshot related to a single persistence id. Events do not have expiry set.
- persistenceId
the persistence id to set expiry for
- timeToLive
time-to-live duration from now
- def setExpiryForSnapshot(persistenceId: String, expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for the snapshot related to a single persistence id.
Set expiry (time to live) for the snapshot related to a single persistence id. Events do not have expiry set.
- persistenceId
the persistence id to set expiry for
- expiryTimestamp
expiration timestamp to set on the snapshot
- def setExpiryForSnapshots(persistenceIds: List[String], timeToLive: Duration): CompletionStage[Done]
Set expiry (time to live) for all snapshots related to the given list of persistence ids.
Set expiry (time to live) for all snapshots related to the given list of persistence ids. Events do not have expiry set.
- persistenceIds
the persistence ids to set expiry for
- timeToLive
time-to-live duration from now
- def setExpiryForSnapshots(persistenceIds: List[String], expiryTimestamp: Instant): CompletionStage[Done]
Set expiry (time to live) for all snapshots related to the given list of persistence ids.
Set expiry (time to live) for all snapshots related to the given list of persistence ids. Events do not have expiry set.
- persistenceIds
the persistence ids to set expiry for
- expiryTimestamp
expiration timestamp to set on all snapshots
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()