bitcoin-atm
bitcoin atm for pyc inc.
git clone https://9o.is/git/bitcoin-atm.git
Ticker.scala
(743B)
1 package inc.pyc.chimera
2 package minions
3
4 import inc.pyc._
5 import bitcoin._
6 import akka.actor._
7 import akka.pattern._
8
9 /**
10 * Minion that has access to bitcoin price ticker
11 * @param service bitcoin price ticker service
12 */
13 class TickerMinion(service: BitcoinService.Value)
14 extends Actor
15 with ActorLogging
16 with Minion
17 with MinionWorker
18 with HttpMinion {
19
20 import context.dispatcher
21
22 def name: String = "Ticker_"+util.Random.nextInt
23 def props: Props = BitcoinService.props(service)
24
25 val tasks: Receive = {
26 case Tick => tick
27 }
28
29 /**
30 * Gets the updated price from the price ticker.
31 */
32 def tick = workout {
33 worker =>
34 val future = ask(worker, Tick).mapTo[Price]
35 pipe (future) to sender
36 }
37 }