title: Akka persistence: deleting "old" messages in journal
body: <p>Cleaning old snapshots in the snapshot store is easy: After each successful snapshot, the actor receives a <code>saveSnapshotSuccess</code> with the meta-data indicating its sequence number, this information can be used to construct a snapshot <code>SnapshotSelectionCriteria</code> and then be fed to <code>deleteSnapshots</code>.</p>
  
  <p>There is however no equivalent to <code>saveSnapshotSuccess</code> for persisting messages. As such, it is not possible to know what the sequence number of the "last-ish" message is in the journal. One could potentially keep a local cache of the persisted messages count and snapshot it, to use for calling <code>deleteMessages</code> but that is too tedious.</p>
  
  <p>Is there a way of using <code>persistence-query</code> to receive the last persisted message for an actor to get an indication of what the sequence number is and then maybe call <code>deleteMessages</code> with say <code>val seqNr = sequenceNumberObtainedFromReadJournal - 100</code>, (assuming that we snapshot the state of the actor, say after every 50 messages)?</p>
  
  <p>P.S. <em>The choice of sequence number for passing to <code>deleteMessages</code> is of course a bit more complicated than mentioned above: even if there is a way of getting the sequence number of the last message for an actor from the journal, one has to worry about the possibility of say the last three snapshots having failed, so it's not as easy as just using 100 and 50) so the implementation would be a bit more involved, but at least we are not contaminating the snapshot type with the persistence sequence count.</em></p>