On Sat, Dec 21, 2013 at 5:18 PM, Derek <[email protected]> wrote: > Patrik, > > Thank you for the response -- that should answer my question. You also > tipped me off that the value returned from calling actorSelection() is > actually an ActorSelection and not an ActorRef (which I had in my head for > some reason, guess b/c you can send messages to both with !). > > So to review, it doesn't matter which of these approaches I use: > > val selToB = system.actorSelection("/user/a/b") > selToB ! "msg-1" > selToB ! "msg-2" > selToB ! "msg-3" > > OR > > system.actorSelection("/user/a/b") ! "msg-1" > system.actorSelection("/user/a/b") ! "msg-2" > system.actorSelection("/user/a/b") ! "msg-3" > > Either way it is guaranteed that the messages will arrive in order (I > understand there's not necessarily a guarantee that any message will > arrive, but 3 will not be delivered before 2 which will not be delivered > before 1). >
Yes, that is correct. > > Thanks again, > You're welcome /Patrik > -Derek > > On Friday, December 20, 2013 10:05:48 AM UTC-6, Derek wrote: >> >> Hi, >> >> I'd like clarification regarding something Roland mentioned in the >> Coursera Reactive Programming class (which my co-workers and I have really >> found useful - nice job Roland!). In one of the lectures he was discussing >> the guarantee that Akka makes regarding the order in which messages are >> received -- specifically that messages between sender-receiver actor pairs >> will not be delivered out of order. >> >> We'd like to know how the guarantee applies when the sender is not >> explicitly an Actor but some other object that has obtained an ActorRef via >> actorSelection? If I look up the ref once and cache it and then send >> multiple messages using that same ref instance, does the same guarantee >> apply as between actor pairs? >> >> What if I don't cache the ref but select it each time this object wants >> to send a message to that same actor ref? >> >> Guessing that even though my object that is sending messages is not an >> actor, under the covers and in order for the message send to work >> correctly, an implicit sender Actor is created and then the message order >> guarantee applies between that sender-receiver pair? So, as long as I >> cache the ActorRef and re-use it the guarantee will hold but if I perform >> an actorSelection each time it may not? >> >> Thanks and Merry Christmas, >> -Derek >> > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> 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/groups/opt_out. > -- Patrik Nordwall Typesafe <http://typesafe.com/> - Reactive apps on the JVM Twitter: @patriknw -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> 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/groups/opt_out.
