Without getting into what "latest" really means in a concurrent system, this is 
an easier pattern with an interface different than the receive one IMO. A 
simple thread that spins(+ sleep + back off etc)  on a sequence number and then 
accesses the "latest" message, applies the change then goes back to waiting 
works pretty well if you can spare an entire thread.

In Akka, you can approximate this behavior with timeouts + some heuristic (wait 
for n messages or y ms timeout). Maybe a custom mailbox could help. Your 
enqueue implementation could just replace the latest message if you are sure 
that is exactly how you plan to use. All concurrency caveats apply of course.

I haven't used Akka's bounded mailbox implementations but at first glance it 
seems like they are backed by blocking queues, which means instead of replacing 
the contents of the only slot, the producer will block till there is an empty 
slot.


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