Re: [akka-user] TimeoutException when using tell on an ActorSelection if the target actor is created through AskSupport

2015-01-10 Thread Patrik Nordwall
On Fri, Jan 9, 2015 at 10:06 PM, Ferdinand Hübner <
ferdinand.hueb...@gmail.com> wrote:

>
>
> On Friday, January 9, 2015 at 7:34:08 PM UTC+1, Patrik Nordwall wrote:
>>
>>
>> 9 jan 2015 kl. 18:10 skrev Ferdinand Hübner :
>>
>> Yes, that is what I'm doing. I'm passing the sender() ActorRef to other
>> actors until I am able to reply to it with deliver. When I reply with
>> delivery, I call path on the ActorRef.
>> In my service layer, I would send a confirmation using tell with
>> ActorRef.noSender once the future from AskSupport completes.
>>
>> That is not going to work. Let's say that the confirmation message is
>> lost. Then AtLeastOnceDelivery will resend it to the path of the
>> PromiseActorRef (created by ask), but that is already completed and the
>> resent message will go to deadLetters, and be retried again.
>>
>
> I am aware of that and decided to ignore it at this point until I am able
> to decide if AtLeastOnceSupport is really something that I want and need.
> My idea was to handle UnconfirmedWarning by simply confirming the messages
> it contains.
>
>
>> Would it be possible to implement it without ask?
>>
>
> Yes, that should be possible. I never really thought about implementing it
> without ask. It's the first thing that came to my mind and worked well so
> far.
> I'll be going for a less temporay actor that completes promises and
> confirms deliveryIds that are not pending completion.
>
> Thank you for the help and your suggestions.
>

You're welcome.
/Patrik


> Ferdinand
>
> --
> >> 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] TimeoutException when using tell on an ActorSelection if the target actor is created through AskSupport

2015-01-09 Thread Ferdinand Hübner


On Friday, January 9, 2015 at 7:34:08 PM UTC+1, Patrik Nordwall wrote:
>
>
> 9 jan 2015 kl. 18:10 skrev Ferdinand Hübner  >:
>
> Yes, that is what I'm doing. I'm passing the sender() ActorRef to other 
> actors until I am able to reply to it with deliver. When I reply with 
> delivery, I call path on the ActorRef.
> In my service layer, I would send a confirmation using tell with 
> ActorRef.noSender once the future from AskSupport completes.
>
> That is not going to work. Let's say that the confirmation message is 
> lost. Then AtLeastOnceDelivery will resend it to the path of the 
> PromiseActorRef (created by ask), but that is already completed and the 
> resent message will go to deadLetters, and be retried again.
>

I am aware of that and decided to ignore it at this point until I am able 
to decide if AtLeastOnceSupport is really something that I want and need. 
My idea was to handle UnconfirmedWarning by simply confirming the messages 
it contains. 
 

> Would it be possible to implement it without ask?
>

Yes, that should be possible. I never really thought about implementing it 
without ask. It's the first thing that came to my mind and worked well so 
far. 
I'll be going for a less temporay actor that completes promises and 
confirms deliveryIds that are not pending completion.

Thank you for the help and your suggestions.
Ferdinand

-- 
>>  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] TimeoutException when using tell on an ActorSelection if the target actor is created through AskSupport

2015-01-09 Thread Patrik Nordwall


> 9 jan 2015 kl. 18:10 skrev Ferdinand Hübner :
> 
> Hi Patrik,
> 
> thank you for the reply.
> 
>> On Friday, January 9, 2015 at 9:49:40 AM UTC+1, Patrik Nordwall wrote:
>> 
>> Let me try to understand your original problem. You send a request with ask 
>> to an Actor with AtLeastOnceDelivery. There you reply to the sender() using 
>> the deliver method (and the path of the sender()). Is that what you are 
>> doing?
> 
> Yes, that is what I'm doing. I'm passing the sender() ActorRef to other 
> actors until I am able to reply to it with deliver. When I reply with 
> delivery, I call path on the ActorRef.
> In my service layer, I would send a confirmation using tell with 
> ActorRef.noSender once the future from AskSupport completes.
> 

That is not going to work. Let's say that the confirmation message is lost. 
Then AtLeastOnceDelivery will resend it to the path of the PromiseActorRef 
(created by ask), but that is already completed and the resent message will go 
to deadLetters, and be retried again.

Would it be possible to implement it without ask?

> To be honest, I'm not sure If what I'm doing is weird somehow because of the 
> temporary actor from AskSupport (I'm experimenting/prototyping). I'm 
> uncertain what would happen upon re-delivery, I guess a dead letter. 
> What perplexes me is that you cannot tell an ActorSelection if you create it 
> by calling path on an ActorRef from AskSupport. Is this by design?

I don't think we have thought of replying to an ask via an actor selection, 
because we have not thought of a use case where it would be needed.

> 
> Ferdinand
> -- 
> >> 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] TimeoutException when using tell on an ActorSelection if the target actor is created through AskSupport

2015-01-09 Thread Ferdinand Hübner
Hi Patrik,

thank you for the reply.

On Friday, January 9, 2015 at 9:49:40 AM UTC+1, Patrik Nordwall wrote:
>
>
> Let me try to understand your original problem. You send a request with 
> ask to an Actor with AtLeastOnceDelivery. There you reply to the sender() 
> using the deliver method (and the path of the sender()). Is that what you 
> are doing?
>

Yes, that is what I'm doing. I'm passing the sender() ActorRef to other 
actors until I am able to reply to it with deliver. When I reply with 
delivery, I call path on the ActorRef.
In my service layer, I would send a confirmation using tell with 
ActorRef.noSender once the future from AskSupport completes.

To be honest, I'm not sure If what I'm doing is weird somehow because of 
the temporary actor from AskSupport (I'm experimenting/prototyping). I'm 
uncertain what would happen upon re-delivery, I guess a dead letter. 
What perplexes me is that you cannot tell an ActorSelection if you create 
it by calling path on an ActorRef from AskSupport. Is this by design?

Ferdinand

-- 
>>  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] TimeoutException when using tell on an ActorSelection if the target actor is created through AskSupport

2015-01-09 Thread Patrik Nordwall
Hi Ferdinand,

Let me try to understand your original problem. You send a request with ask
to an Actor with AtLeastOnceDelivery. There you reply to the sender() using
the deliver method (and the path of the sender()). Is that what you are
doing?

/Patrik


On Wed, Jan 7, 2015 at 8:07 PM, Ferdinand Hübner <
ferdinand.hueb...@gmail.com> wrote:

> Hello,
>
> I am experimenting with at-least-once-delivery in akka-persistence. My
> goal is to create a future-based service layer on top of an actor system by
> using AskSupport.
>
> The deliver method in AtLeastOnceDelivery expects an ActorPath as its
> message destination and delivers the message by using tell on an
> ActorSelection created from the ActorPath.
> Using tell on an ActorSelection always results in a TimeoutException in my
> unit tests if the target of the ActorSelection is a temporary actor created
> by AskSupport.
>
> I created a test-case on github that can be used to reproduce the problem:
> https://github.com/ferdinandhuebner/akka-asksupport-actorselection
>
> Here's a direkt link to the test-suite:
>
> https://github.com/ferdinandhuebner/akka-asksupport-actorselection/blob/master/src/test/scala/ActorSelectionVsAskSupportSuite.scala
>
> I tested with Java 1.8, 1.7 and akka 2.3.8, 2.3.7, 2.3.4 and 2.3.2, the
> result is always the same.
>
> Is this an expected behaviour of ActorSelection and temporary actors
> created through AskSupport?
>
> What I can tell from debugging the code: ActorSelection#deliverSelection
> doesn't seem to be able to resolve the temporary actor.
> After a few recursions it ends in a case that is commented with "foreign
> ref" and calls tell on an ActorRef [akka://test/temp] instead of
> [akka://test/temp/$a]
>
> I added another test-case with a proxy intermediary that receives the
> message from the AskSupport actor and sends it to the desired target. That
> code works fine. However, I want to avoid creating proxy actors.
> I don't think that I'm accidentally blocking somewhere in my test-code,
> since the test with the proxy actor runs fine.
>
> If anybody can share any hints or feedback, I would appreciate it.
>
> Thank you,
> Ferdinand
>
>  --
> >> 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.