Daniel: The Coalescing Ring Buffer from the LMAX Collections seems like the exact thing you want though it's non-Akka. Their sample<https://github.com/LMAX-Exchange/LMAXCollections/blob/master/CoalescingRingBuffer-samples/src/main/java/com/lmax/collections/coalescing/ring/buffer/Example.java> shows how to use the latest stock price in a single producer, single consumer topology.
https://github.com/LMAX-Exchange/LMAXCollections Rajiv On Monday, March 17, 2014 10:43:21 PM UTC-7, Daniel Wang wrote: > > Nope, Rajiv and I are two:) > > On Monday, March 17, 2014 5:31:37 PM UTC+8, rkuhn wrote: >> >> Hi Rajiv, >> >> I guess you have seen the answers to the other thread which Daniel >> started. Was it a coincidence that both of you sent messages with exactly >> the same subject line within the same hour? Are you the same person? ;-) >> >> Regards, >> >> Roland >> >> >> 16 mar 2014 kl. 08:48 skrev Rajiv Kurian <[email protected]>: >> >> > 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. >> >> >> >> Dr. Roland Kuhn >> Akka Tech Lead >> Typesafe – Reactive apps on the JVM. >> twitter: @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.
