Process only last message pattern

25 views
Skip to first unread message

Edmondo Porcu

unread,
May 24, 2012, 2:09:10 AM5/24/12
to akka...@googlegroups.com
Dear users,
I have to implement a system where a given number of event might occur in a certain lifetime and I want to process in batch. Namely each event should trigger the recomputation of the same object, let's say for example the value of the dow Jones index.

At each time I need to compute it I should  read from my data layer all the value of the shares composing the index and apply a formula, which takes a given time to be executed.

In case a stock price changes during the computation, this recomputation event must be queued and processed later. In case many of them changes, this will have to trigger a single recomputation since at the moment I will recompute I will have to read all the stock prices, including the unchanged ones , thus I will get the picture of the last available quotes for all stocks.

How could I implement this use case?

Thank you
Edmondo

Inviata dal mio Windows Phone

Björn Antonsson

unread,
May 24, 2012, 3:14:20 PM5/24/12
to akka...@googlegroups.com
Hi Edmondo,
I would simply model the index as an actor, that in its internal state holds the last interesting value of all the required instruments. When it receives an update to an instrument, it will simply recompute its own index value based on all the instrument values it has. No need to read something from somewhere.

B/ 
Thank you
Edmondo

Inviata dal mio Windows Phone

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
-- 
Björn Antonsson
Typesafe - The software stack for applications that scale

Reply all
Reply to author
Forward
0 new messages