I am having some troubles understanding the finer details of the PoisonPill.

As I understand it, it is a normal message, and will be processed AFTER the 
persist-callback is executed.

I have the following code in my onReceiveCommand:

System.out.println("About to persist: " + message);
persist(message, o -> System.out.println("Persisted: " + o));


When I run the following against this actor 8not using TestActorRef):

actorRef.tell("Test message", getTestActor());
Thread.sleep(1000L);
actorRef.tell(PoisonPill.getInstance(), getTestActor());

Thread.sleep(1000L);


I get the expected output:

About to persist: Test message
Persisted: Test message


If I remove the sleep between the messages, I sometimes get the following:

[INFO] [04/16/2015 15:50:11.183] [Test-System-akka.actor.default-dispatcher-
5] [akka://Test-System/user/my-actor] Message [akka.persistence.Recover] 
from Actor[akka://Test-System/user/my-actor#867538471] to 
Actor[akka://Test-System/user/my-actor#867538471] was not delivered. [1] 
dead letters encountered. [...]

How is this possible? It seems the PoisonPill arrived first... But message 
ordering should be guaranteed between sender (testActor) and my actor, 
right?

If I add a short sleep between the two tell, I sometimes get different 
(internal) messages in deadletters.

Best regards,

Anders



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