I've written some scala code to simulate a stock exchange (actually just the order book) at https://gist.github.com/falconair/d669cac75ecab0010e9a
I wrote this just to learn scala so please don't expect production code here. I'm having trouble understanding how to convert this to use actors. Currently, OrderBook is an object with only three public methods: processOrderBookRequest() listenForEvents() listenForMarketData() The first one, processOrderBookRequest accepts events, such as create new order, cancel order, etc. listenForEvents() is used to subscribe for responses to those events, such as new order accepted, order canceled, order filled, order rejected, etc. listenForMarketData() is also used to subscribe to updates published by the OrderBook object. Any number of 'clients' can send requests or subscribe to updates. Note that events are being sent to OrderBook or sent by OrderBook to whoever subscribes to them. No one is supposed to directly call a method on the object to get its internal state. In other words, this is already supposed to operate as a 'process.' I can naturally turn OrderBook into an actor and publish events to it. I suppose those who are only interested in subscribing to market data can send a 'subscribe to market data' event to OrderBook where the object will add the sender to its list of subscribers...similar to how it is done now. Same is true for non-market data events. I'm not sure if what I'm thinking is the correct way of using actors. I'd love someone to take a look at the code (about 250 lines) and tell me if I'm headed in the wrong direction. If this is the wrong place to ask such a question, please let me know. Thanks -- >>>>>>>>>> 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.
