On Tue, Jul 8, 2014 at 1:28 PM, Chanan Braunstein <
chanan.braunst...@pearson.com> wrote:

> How we would he know? I have no idea, I don't know the akka source code,
> that is up to you guys to figure out :)
>
> Maybe, instead of Supervisor getting a message that is the exception he
> gets another type that has the exception, the sender and the original
> message that caused the error? I have no idea if that is possible or not.
>
> In my case the answer to what he would get back is easy. He would get back
> a Failure message with the exception.
>
> As I said, I have no idea if that is possible or not, but the way it is
> now, unless you have some suggestion I can do, doing an Ask from a Play
> controller means that I cannot use Akka Supervision.
>

If you want the parent of your actor to be a part of the protocol for that
actor (which I do not recommend), I think you need to catch exceptions and
wrap them in a custom exception that also retains a ref to the current
sender:

case class UnexpectedException(replyTo: ActorRef, cause: Throwable) extends
IllegalStateException(cause)


But if you do that, you may as well just do a try-catch and reply with a
failure to the sender before rethrowing and having the supervisor handling
it.


>
>
> On Tuesday, July 8, 2014 7:24:07 AM UTC-4, √ wrote:
>
>> Hi Chanan,
>>
>> how would the supervisor know who the sender was and what he expects to
>> get back?
>>
>>
>> On Tue, Jul 8, 2014 at 1:22 PM, Chanan Braunstein <
>> chanan.b...@pearson.com> wrote:
>>
>>> Hi Martunas,
>>>
>>> So there is no way to get the original sender? It this simple case, of
>>> course I can catch the exception in the worker, but in our real world
>>> cases, we wanted to not do that and use supervision, but we will always
>>> have to return something to the controller, otherwise it will just return a
>>> timeout to the controller without us knowing what the real problem was.
>>> That means we will never be able to use supervision if we wanted to avoid
>>> that timeout.
>>>
>>> --
>>> >>>>>>>>>> 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.
>>>
>>
>>
>>
>> --
>> Cheers,
>> √
>>
>  --
> >>>>>>>>>> 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.
>



-- 
Cheers,
√

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

Reply via email to