SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class SecurityPricingActor(exchange: Exchange, backOffice: BackOffice) extends Actor {
  2.   def receive = {
  3.     case GetPricingInfo(security: Security) =>
  4.       val originalSender = sender
  5.       val bidAndAskFuture = Future { exchange.getBidAndAsk(security.id) }
  6.       val lastPriceFuture = Future { backOffice.getLastPrice(security.id) }
  7.    
  8.       val response = for {
  9.         (bid, ask) = bidAndAskFuture
  10.         lastPrice = lastPriceFuture
  11.       } yield SecurityPricing(bid, ask, lastPrice)
  12.    
  13.       response map (originalSender ! _)
  14.   }
  15. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top