Hi,

I revised my implementation and done with
https://gist.github.com/whiter4bbit/22cd3b0909bb390e80db. For my particular
case there is relatively long window between requests, in many cases
Appends and Removes count will match (also possible by calling
confirmDelivery for messages, that not delivered for some timeout).
So, I'm done with checking if numberOfUnconfirmed is zero and removing all
messages from journal in this case - I think it is same as tracking seqNr
for each message (but I can't find a way to do this, I can just get this Nr
after message is stored).
Also need to store snapshot before removing all messages, it is need to
adjust deliveryId during actor recovery.
But disadvantage of this approach is:

    case SaveSnapshotSuccess(meta) => {
      log.info("Snapshot stored: {}", meta)
      compactToSeqNr.map(deleteMessages(_, true)) // if delete
messages fails, then deliveryId will be diverged
      compactToSeqNr = None
    }

(Same when removing messages, then saving snapshot)

But I think it can be avoided by using custom id generator and adding those
ids as parameters for Append and Removes (as I did in my first
impementation)

Pavel.


2014-07-14 19:27 GMT+03:00 Pavel Zalunin <[email protected]>:

> Hi,
>
> Thanks for explaining delivery semantics, actually it is in scala doc at
> both trait and method description, missed it, maybe some example can fit
> well in documentation:). And thanks for persistence module at all - with
> 2.3.2 our app works well for last few months!
>
> Regarding deliveryIds. Two things:
> 1) I need to tag 'Append' with unique id, because I can send two same
> messages and both should be delivered, without id I can end with:
> Append(Request("example.com/r2"))
> Append(Request("example.com/r1"))
> Append(Request("example.com/r2"))
>
> Remove(Request("example.com/r2"))
>
> And last remove is confusing - I don't know which append it corresponds to
> - 1st or 3rd, it can matter when receiving actor state depends on messages
> ordering, thus I added id field here (uuid not a good solution probably,
> but ok for testing)
>
> 2) When I receive command I need to:
>   a) persist corresponding Append,
>   b) make a delivery call
>   c) when actor responds with Confirm, I need to persist 'Remove', that
> corresponding to 'Append' persisted at a) - that is I need to know which id
> has this append, as delivery id generated at b) I can't rely on it.
>
> About pruning log. As you pointed, I can't rely on pattern
> Append/Remove/Append/Remove/Append/Remove in journal, that's why I
> mentioned removing all messages and storing just sequence of appends, that
> I got after removing Appends with corresponding Removes after
> RecoveryCompleted. Regarding removing messages based on seqId, I think it
> is trickly because I need to know exact seqIds for Append/Remove in logs,
> but lastSeqenceNr I can get just after successful persist event (but I'm
> not sure, maybe it incremented asynchronously), so when I'm storing Append
> I need to pass exact instance to persist, but I don't know seqId where it
> can be stored
> persist(Append(...))(_ => //here maybe I can get seqId)
>
>
> Pavel.
>
>
> 2014-07-14 17:05 GMT+03:00 Konrad Malawski <[email protected]>:
>
> This thread motivated me to improve the documentation on these methods a
>> bit, progress can be tracked in this issue:
>> https://github.com/akka/akka/issues/15538
>>
>> -- k
>>
>> --
>> >>>>>>>>>> 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.
>>
>
>

-- 
>>>>>>>>>>      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.

Reply via email to