Re: [akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Patrik Nordwall



> 23 maj 2014 kl. 17:53 skrev Lawrence Wagerfield :
> 
> That should be:
> 
> self ! Recover()
> 
>> On Friday, May 23, 2014 4:50:25 PM UTC+1, Lawrence Wagerfield wrote:
>> Ahh brilliant :)
>> 
>> One thing I'm struggling with though:
>> 
>> I'm looking through the source for Processor and I don't understand how 
>> calling sender ! Recover() is optional, given the initial receive must be 
>> performing similar stashing/unstashing to ensure recovery is processed 
>> first. 
>> 
>> However, if the Recover() never arrives (i.e. I opt-out of recovery on 
>> start-up), then I would have thought all messages would be indefinitely 
>> stashed.

Correct, indefinitely stashed or out of memory or reaching the configured stash 
limit. Anyway, it's not useful to not send Recover. What might be useful is to 
Recover to another point in the history than default (latest).

/Patrik
>> 
>> I guess I don't need to worry about this (unless I land a job at TypeSafe!), 
>> but am curious nonetheless.
>> 
>> Thanks,
>> Lawrence
>> 
>> 
>>> On Friday, May 23, 2014 4:44:52 PM UTC+1, Patrik Nordwall wrote:
>>> and we have a ticket to support this even better: 
>>> https://github.com/akka/akka/issues/13944
>>> 
>>> /Patrik
>>> 
>>> 
 On Fri, May 23, 2014 at 5:32 PM, Lawrence Wagerfield 
  wrote:
 Thank you, exactly what I needed :)
 
 
> On Friday, May 23, 2014 4:30:40 PM UTC+1, Konrad Malawski wrote:
> Hello Lawrence!
> No additional callback is provided, but there is a nice pattern that 
> effectively provides the same functionality:
> 
> Please check the section of the docs about recovery status: 
> http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html#recovery-status
> If you’d keep the “last msg” around, and then you get your “FIRST” msg, 
> you know recovery has finished and you can run your logic.
> 
> I hope this helps, happy hakking!
> 
> -- 
> Konrad 'ktoso' Malawski
> hAkker @ typesafe
> 
> 
 
 -- 
 >> 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 akka-user+...@googlegroups.com.
 To post to this group, send email to akka...@googlegroups.com.
 Visit this group at http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.
>>> 
>>> 
>>> 
>>> -- 
>>> Patrik Nordwall
>>> Typesafe -  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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> 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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Lawrence Wagerfield
That should be:

self ! Recover()

On Friday, May 23, 2014 4:50:25 PM UTC+1, Lawrence Wagerfield wrote:
>
> Ahh brilliant :)
>
> One thing I'm struggling with though:
>
> I'm looking through the source for Processor and I don't understand how 
> calling sender ! Recover() is optional, given the initial receive must be 
> performing similar stashing/unstashing to ensure recovery is processed 
> first. 
>
> However, if the Recover() never arrives (i.e. I opt-out of recovery on 
> start-up), then I would have thought all messages would be indefinitely 
> stashed.
>
> I guess I don't need to worry about this (unless I land a job at 
> TypeSafe!), but am curious nonetheless.
>
> Thanks,
> Lawrence
>
>
> On Friday, May 23, 2014 4:44:52 PM UTC+1, Patrik Nordwall wrote:
>>
>> and we have a ticket to support this even better: 
>> https://github.com/akka/akka/issues/13944
>>
>> /Patrik
>>
>>
>> On Fri, May 23, 2014 at 5:32 PM, Lawrence Wagerfield <
>> lawr...@dmz.wagerfield.com> wrote:
>>
>>> Thank you, exactly what I needed :)
>>>
>>>
>>> On Friday, May 23, 2014 4:30:40 PM UTC+1, Konrad Malawski wrote:

 Hello Lawrence!
 No additional callback is provided, but there is a nice pattern that 
 effectively provides the same functionality:

 Please check the section of the docs about recovery status: 
 
 http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html#recovery-
 status
 If you’d keep the “last msg” around, and then you get your “FIRST” msg, 
 you know recovery has finished and you can run your logic.

 I hope this helps, happy hakking!

 -- 
 Konrad 'ktoso' Malawski
 hAkker @ typesafe

 

>>>  -- 
>>> >> 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 akka-user+...@googlegroups.com.
>>> To post to this group, send email to akka...@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> -- 
>>
>> Patrik Nordwall
>> Typesafe  -  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Lawrence Wagerfield
Ahh brilliant :)

One thing I'm struggling with though:

I'm looking through the source for Processor and I don't understand how 
calling sender ! Recover() is optional, given the initial receive must be 
performing similar stashing/unstashing to ensure recovery is processed 
first. 

However, if the Recover() never arrives (i.e. I opt-out of recovery on 
start-up), then I would have thought all messages would be indefinitely 
stashed.

I guess I don't need to worry about this (unless I land a job at 
TypeSafe!), but am curious nonetheless.

Thanks,
Lawrence


On Friday, May 23, 2014 4:44:52 PM UTC+1, Patrik Nordwall wrote:
>
> and we have a ticket to support this even better: 
> https://github.com/akka/akka/issues/13944
>
> /Patrik
>
>
> On Fri, May 23, 2014 at 5:32 PM, Lawrence Wagerfield <
> lawr...@dmz.wagerfield.com > wrote:
>
>> Thank you, exactly what I needed :)
>>
>>
>> On Friday, May 23, 2014 4:30:40 PM UTC+1, Konrad Malawski wrote:
>>>
>>> Hello Lawrence!
>>> No additional callback is provided, but there is a nice pattern that 
>>> effectively provides the same functionality:
>>>
>>> Please check the section of the docs about recovery status: 
>>> 
>>> http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html#recovery-
>>> status
>>> If you’d keep the “last msg” around, and then you get your “FIRST” msg, 
>>> you know recovery has finished and you can run your logic.
>>>
>>> I hope this helps, happy hakking!
>>>
>>> -- 
>>> Konrad 'ktoso' Malawski
>>> hAkker @ typesafe
>>>
>>> 
>>>
>>  -- 
>> >> 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 akka-user+...@googlegroups.com .
>> To post to this group, send email to akka...@googlegroups.com
>> .
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Typesafe  -  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Patrik Nordwall
and we have a ticket to support this even better:
https://github.com/akka/akka/issues/13944

/Patrik


On Fri, May 23, 2014 at 5:32 PM, Lawrence Wagerfield <
lawre...@dmz.wagerfield.com> wrote:

> Thank you, exactly what I needed :)
>
>
> On Friday, May 23, 2014 4:30:40 PM UTC+1, Konrad Malawski wrote:
>>
>> Hello Lawrence!
>> No additional callback is provided, but there is a nice pattern that
>> effectively provides the same functionality:
>>
>> Please check the section of the docs about recovery status: 
>> 
>> http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html#recovery-status
>> If you’d keep the “last msg” around, and then you get your “FIRST” msg,
>> you know recovery has finished and you can run your logic.
>>
>> I hope this helps, happy hakking!
>>
>> --
>> Konrad 'ktoso' Malawski
>> hAkker @ typesafe
>>
>> 
>>
>  --
> >> 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 akka-user+unsubscr...@googlegroups.com.
> To post to this group, send email to akka-user@googlegroups.com.
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Typesafe  -  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Lawrence Wagerfield
Thank you, exactly what I needed :)

On Friday, May 23, 2014 4:30:40 PM UTC+1, Konrad Malawski wrote:
>
> Hello Lawrence!
> No additional callback is provided, but there is a nice pattern that 
> effectively provides the same functionality:
>
> Please check the section of the docs about recovery status: 
> 
> http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html#recovery-status
> If you’d keep the “last msg” around, and then you get your “FIRST” msg, 
> you know recovery has finished and you can run your logic.
>
> I hope this helps, happy hakking!
>
> -- 
> Konrad 'ktoso' Malawski
> hAkker @ typesafe
>
> 
>

-- 
>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Konrad 'ktoso' Malawski
Hello Lawrence!
No additional callback is provided, but there is a nice pattern that 
effectively provides the same functionality:

Please check the section of the docs about recovery status: 
http://doc.akka.io/docs/akka/2.3.3/scala/persistence.html#recovery-status
If you’d keep the “last msg” around, and then you get your “FIRST” msg, you 
know recovery has finished and you can run your logic.

I hope this helps, happy hakking!

-- 
Konrad 'ktoso' Malawski
hAkker @ typesafe

-- 
>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


[akka-user] Is there an 'onRecovered' hook in EventsourcedProcessor? (Implementing a 'redo transaction')

2014-05-23 Thread Lawrence Wagerfield
My EventsourcedProcessor needs to redo some operation if it was only half 
completed.

The events in my system are as follows, where the first event marks the 
beginning of a transaction, and the latter two are mutually exclusive 
outcomes:

UserRegistrationSubmitted
UserRegistered
UserRegistrationDenied

Recovery needs to handle cases where the outcome is undetermined.

This is easy to do in theory as all I need is an 'onRecovered' method to 
override in the EventsourcedProcessor. I would then re-run the registration 
process, post-recovery, if the last event is 'UserSubmittedRegistration'.

How can I achieve this? Or is this bad behaviour for a recovery? If so: 
what's the recommended practice for implementing a redo / handling 
incomplete transactions?

Thanks,
Lawrence

-- 
>>  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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.