I think the line that might cause confusion here is

inbox.send(greeter, new Greet());

The inbox can be seen as a "mediator" and therefore perceived as it might
not preserve ordering. For this reason I would prefer to write it as:

greeter.tell(new Greet(), inbox.getRef());

That is exactly how inbox.send is implemented, so the ordering is just fine.

Cheers,
Patrik

On Wed, Sep 7, 2016 at 10:58 AM, Guido Medina <oxyg...@gmail.com> wrote:

> In the introduction chapter of Akka this is explained in details, how Akka
> takes care of it,
> I suggest you go there to learn the exact details:
>
> http://doc.akka.io/docs/akka/2.4.10/general/message-
> delivery-reliability.html#Discussion__Message_Ordering
>
> HTH,
>
> Guido.
>
>
>
> On Tuesday, September 6, 2016 at 5:12:32 PM UTC+1, que...@gmail.com wrote:
>>
>> The order that they are received would be the critical thing, I would
>> think. So, is the example not dealing with the possibility that the
>> messages could be received out of order? Or, is this somehow taken care of?
>>
>> Kendall
>>
>> On Monday, September 5, 2016 at 2:40:34 AM UTC-7, Tal Pressman wrote:
>>>
>>> Hi,
>>>
>>> Message ordering is preserved between a sender-receiver pair. However,
>>> this refers to the actual actual actor sending the message, regardless of
>>> the ActorRef passed as the sender reference.
>>> In the example above, both messages are being sent from the same
>>> context, and therefor should be sent in-order.
>>>
>>> Tal
>>>
>>>
>>> On Saturday, September 3, 2016 at 8:19:33 AM UTC+3, que...@gmail.com
>>> wrote:
>>>>
>>>> I'm early in learning Akka. The hello-akka-java8 tutorial has
>>>> greeter.tell from no actor, followed by inbox.send:
>>>>
>>>> final ActorRef greeter = system.actorOf(Props.create(Greeter.class),
>>>> "greeter");
>>>> final Inbox inbox = Inbox.create(system);
>>>> greeter.tell(new WhoToGreet("akka"), ActorRef.noSender());
>>>> inbox.send(greeter, new Greet());
>>>> Greeting greeting1 = (Greeting) inbox.receive(Duration.create(5,
>>>> TimeUnit.SECONDS));
>>>>
>>>> Can I expect that the greeter actor is going to process new
>>>> WhoToGreet("akka"), before new Greet()?
>>>>
>>>> If so, why?
>>>>
>>>> I read in Akka documentation:
>>>>
>>>> "*...for a given pair of actors, messages sent directly from the first
>>>> to the second will not be received out-of-order.* The word *directly* 
>>>> emphasizes
>>>> that this guarantee only applies when sending with the telloperator to
>>>> the final destination, not when employing mediators or other message
>>>> dissemination features (unless stated otherwise)."
>>>>
>>>> I think the tutorial is not sending messages from one actor.
>>>>
>>>>
>>>> --
> >>>>>>>>>> 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 https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 

Patrik Nordwall
Akka Tech Lead
Lightbend <http://www.lightbend.com/> -  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 https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to