Hi Christian,

the only safe (meaning: consistent) question is: what is the next message that 
I have received. That there is a mailbox that may hold multiple of them is not 
really relevant because you cannot safely reason about its contents—everything 
outside of an actor is concurrent and non-deterministic. In addition, Actors 
are all about state, modeling state in a distributed setting is their only 
purpose. Dropping some messages while not dropping others of the same quality 
surely is a stateful activity.

So, yes, one could be tempted to give low-level access to the mailbox data 
structure for various reasons, but in all cases that has been a bad idea in the 
past, and I am pretty certain that extrapolation into the future is valid.

Regards,

Roland

> 25 sep 2015 kl. 09:07 skrev Christian Schmitt <[email protected]>:
> 
> Currently that's a good suggestion, however that involve's state is there a 
> better one?
> 
> Am Freitag, 25. September 2015 07:24:19 UTC+2 schrieb Patrik Nordwall:
> Adding to Heiko's suggestion. Perhaps you don't know how many messages to 
> ignore? Then you can send another message to self, wrapping the Message. 
> Ignore all incoming messages until you receive the wrapped Message. Then you 
> know that you have drained the mailbox.
> 
> /Patrik 
> tors 24 sep 2015 kl. 19:49 skrev Heiko Seeberger <[email protected] 
> <javascript:>>:
> You could change the behavior via `context.become` to a new one which ignores 
> the respective message(s).
> 
> Heiko
> 
> --
> 
> Heiko Seeberger
> Home: heikoseeberger.de <http://heikoseeberger.de/>
> Twitter: @hseeberger <https://twitter.com/hseeberger>
> Public key: keybase.io/hseeberger <https://keybase.io/hseeberger>
> 
>> On 24 Sep 2015, at 17:37, Christian Schmitt <[email protected] 
>> <javascript:>> wrote:
>> 
>> Hello, currently I send Messages to an Actor which all does the same thing.
>> 
>> So my Actor will do the same action in a few ms which is bad, is there a way 
>> to just drop the mailbox before I run my command inside the Akka Actor? 
>> something like:
>> 
>> 
>> def recieve = {
>> case Message =>  cleanupMailbox(); doSomething();
>> }
>> 
>> -- 
>> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
>> >>>>>>>>>> Check the FAQ: 
>> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
>> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
>> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
>> >>>>>>>>>> <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] <javascript:>.
>> To post to this group, send email to [email protected] <javascript:>.
>> Visit this group at http://groups.google.com/group/akka-user 
>> <http://groups.google.com/group/akka-user>.
>> For more options, visit https://groups.google.com/d/optout 
>> <https://groups.google.com/d/optout>.
> 
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <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] <javascript:>.
> To post to this group, send email to [email protected] <javascript:>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> -- 
> /Patrik
> 
> -- 
> >>>>>>>>>> Read the docs: http://akka.io/docs/ <http://akka.io/docs/>
> >>>>>>>>>> Check the FAQ: 
> >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html 
> >>>>>>>>>> <http://doc.akka.io/docs/akka/current/additional/faq.html>
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user 
> >>>>>>>>>> <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] 
> <mailto:[email protected]>.
> To post to this group, send email to [email protected] 
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/akka-user 
> <http://groups.google.com/group/akka-user>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.



Dr. Roland Kuhn
Akka Tech Lead
Typesafe <http://typesafe.com/> – Reactive apps on the JVM.
twitter: @rolandkuhn
 <http://twitter.com/#!/rolandkuhn>

-- 
>>>>>>>>>>      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 [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/d/optout.

Reply via email to