Make sure you're receiving the snapshot success message.
case SaveSnapshotSuccess(metadata) => {
deleteMessages(metadata.sequenceNr, true)
}
You can also save that metadata in case you want to clean up snapshots. Per
Patrik's comment, you may want to verify that some interval has passed
before you deleteMessages. If you want, you can also track the last
snapshot for easy deletion.
lastSnapshot.foreach( m => deleteSnapshot(m.sequenceNr, m.timestamp))
On Thursday, September 18, 2014 5:06:55 AM UTC-6, Brian McGee wrote:
>
> Hey,
>
> I'm implementing a PersistentActor which batches writes for a db. After
> successfully writing a batch I can't figure out how to determine the latest
> message number I should use to pass to deleteMessages to prevent the events
> I just persisted to the db from appearing in the recovery. Any ideas?
>
> Brian
>
> On Wednesday, February 19, 2014 3:08:37 PM UTC+1, [email protected]
> wrote:
>>
>> Agreed - in our legacy system, we have a storage manager that removes old
>> journals and snapshots as space is needed. The old journals are sometimes
>> very useful for postmortem analysis.
>>
>> -david
>>
>> On Wednesday, February 19, 2014 2:45:17 AM UTC-5, Patrik Nordwall wrote:
>>>
>>> You can use deleteMessages to delete all messages up to a specified
>>> sequence number. I would not use it too eagerly, since the information in
>>> the history can be valuable in itself, but that is of course depending on
>>> the application.
>>>
>>> /Patrik
>>>
>>>
>>> On Tue, Feb 18, 2014 at 9:39 PM, <[email protected]> wrote:
>>>
>>>> I would assume that a common scenario is to periodically snapshot state
>>>> and keep 1 or more snapshots. In this case, I assume that as you delete
>>>> older snapshots, you would also delete messages older than the snapshot
>>>> from the journal in order to keep the journal from growing indefinitely.
>>>>
>>>> Is this a typical usage or am I missing something? I don't see
>>>> anything in the code that automatically does this (and I didn't really
>>>> expect to given the general flexibility theme of the framework). However,
>>>> I don't see anything in the documentation that alludes to any other use of
>>>> deleteMessage other than in dealing with exceptions.
>>>>
>>>> -david
>>>>
>>>> --
>>>> >>>>>>>>>> Read the docs: http://akka.io/docs/
>>>> >>>>>>>>>> Check the FAQ: http://akka.io/faq/
>>>> >>>>>>>>>> Search the archives:
>>>> https://groups.google.com/group/akka-user
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Akka User List" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at http://groups.google.com/group/akka-user.
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>
>>>
>>>
>>>
>>> --
>>>
>>> Patrik Nordwall
>>> Typesafe <http://typesafe.com/> - Reactive apps on the JVM
>>> Twitter: @patriknw
>>>
>>>
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.