These are chat archives for akkadotnet/akka.net

16th
Apr 2018
Stijn Herreman
@stijnherreman
Apr 16 2018 08:15
@nathvi because your actor could still be busy, 1ms isn't that long. 1 second gives you better assurance that the actor doesn't send out a message.
Paul Trandem
@ptrandem
Apr 16 2018 15:27
Does anyone know if there's a way to get the CurrentMessage in PostStop() ?
Aaron Stannard
@Aaronontheweb
Apr 16 2018 15:27
@ptrandem technically there isn't a CurrentMessage in that state since it occurs after the actor has begun terminating
it'd be the system message that triggers the actor to run its PostStop sequence
that would be the current message there
are you trying to get access to whatever is inside the mailbox?
for recovery / replay purposes?
Paul Trandem
@ptrandem
Apr 16 2018 15:29
I'm trying to put together a pattern that responds with the original problem message after a certain # of supervisor-initiated restarts.
I'd like to respond to the parent with the original sender and message
Aaron Stannard
@Aaronontheweb
Apr 16 2018 15:30
ah, I see
Paul Trandem
@ptrandem
Apr 16 2018 15:30
once the superviser has issued a stop
Aaron Stannard
@Aaronontheweb
Apr 16 2018 15:30
let me look real quick
might be a method on the ActorCell
Paul Trandem
@ptrandem
Apr 16 2018 15:32
In debugging in my little test, I have a breakpoint in PostStop() and the CurrentMessage on Context is a reference to my own TestMessage, so that's why I assumed that's what I'd need.
so this is a little hacky IMHO
but
if your actor throws
and gets stopped
CurrentMessage is still the original message that caused the throw
because CurrentMessage = null never gets to run
exception disrupted it
so looks like it should still be preserved
if you just use that property
Paul Trandem
@ptrandem
Apr 16 2018 15:43
Using that property would be great, but it's not exposed via IActorContext; i can only see it in the debugger.
I'll take a look at ActorCell as well.
Aaron Stannard
@Aaronontheweb
Apr 16 2018 15:44
if you do IActorContext.AsInstanceOf<ActorCell>
that would do it\
it's assignable to that type
like I said, hacky
but it should work
Paul Trandem
@ptrandem
Apr 16 2018 15:45
aah! ok. Hacky, yes, but we'll give that a shot. Thanks @Aaronontheweb !