diff options
author | Diego <diegolparra@gmail.com> | 2014-08-29 02:44:47 -0300 |
---|---|---|
committer | Diego <diegolparra@gmail.com> | 2014-08-29 02:44:47 -0300 |
commit | 83dc815df9d760dd03f76e5d8dfe2d5d5274a296 (patch) | |
tree | 60f000fbdcec5b4d3e7f84e940c90989b30e0d89 /kamon-playground/src/main/scala/test | |
parent | dc5c3fb65085af225464768e0e672075713135d6 (diff) | |
download | Kamon-83dc815df9d760dd03f76e5d8dfe2d5d5274a296.tar.gz Kamon-83dc815df9d760dd03f76e5d8dfe2d5d5274a296.tar.bz2 Kamon-83dc815df9d760dd03f76e5d8dfe2d5d5274a296.zip |
= core: fix errors in last commit
Diffstat (limited to 'kamon-playground/src/main/scala/test')
-rw-r--r-- | kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala | 64 |
1 files changed, 15 insertions, 49 deletions
diff --git a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala index 58a1478c..1db2db67 100644 --- a/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala +++ b/kamon-playground/src/main/scala/test/SimpleRequestProcessor.scala @@ -17,30 +17,28 @@ package test import akka.actor._ -import spray.routing.SimpleRoutingApp +import akka.routing.RoundRobinPool import akka.util.Timeout -import spray.httpx.RequestBuilding -import scala.concurrent.{ Await, Future } -import kamon.spray.KamonTraceDirectives -import scala.util.Random -<<<<<<< Updated upstream -import akka.routing.{ RoundRobinRoutingLogic, Router, ActorRefRoutee, RoundRobinPool } -======= -import akka.routing.{RoundRobinRoutingLogic, Router, ActorRefRoutee, RoundRobinPool} ->>>>>>> Stashed changes -import kamon.trace.TraceRecorder import kamon.Kamon +import kamon.metric.Subscriptions.TickMetricSnapshot import kamon.metric._ +import kamon.spray.KamonTraceDirectives +import kamon.trace.TraceRecorder import spray.http.{ StatusCodes, Uri } -import kamon.metric.Subscriptions.TickMetricSnapshot +import spray.httpx.RequestBuilding +import spray.routing.SimpleRoutingApp + +import scala.concurrent.{ Await, Future } +import scala.util.Random object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuilding with KamonTraceDirectives { - import scala.concurrent.duration._ - import spray.client.pipelining._ import akka.pattern.ask + import spray.client.pipelining._ + + import scala.concurrent.duration._ implicit val system = ActorSystem("test") - import system.dispatcher + import test.SimpleRequestProcessor.system.dispatcher val printer = system.actorOf(Props[PrintWhatever]) @@ -69,15 +67,8 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil //Kamon(UserMetrics).registerGauge("test-gauge")(() => 10L) val pipeline = sendReceive -<<<<<<< Updated upstream val replier = system.actorOf(Props[Replier].withRouter(RoundRobinPool(nrOfInstances = 4)), "replier") - val master = system.actorOf(Props[Replier].withRouter(RoundRobinPool(nrOfInstances = 7)), "master") -======= - val replier = system.actorOf(Props[Replier].withRouter(RoundRobinPool(nrOfInstances = 2)), "replier") - val master = system.actorOf(Props[Master], "Master") - master ! Work() ->>>>>>> Stashed changes val random = new Random() startServer(interface = "localhost", port = 9090) { @@ -110,12 +101,7 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil path("ok") { traceName("OK") { complete { -<<<<<<< Updated upstream - (master ? "Ok").mapTo[String] -======= - master ! Work() "ok" ->>>>>>> Stashed changes } } } ~ @@ -144,27 +130,6 @@ object SimpleRequestProcessor extends App with SimpleRoutingApp with RequestBuil } -case class Work() -class Master extends Actor { - var router = { - val routees = Vector.fill(5) { - val r = context.actorOf(Props[PrintWhatever]) - context.watch(r) - ActorRefRoutee(r) - } - Router(RoundRobinRoutingLogic(), routees) - } - def receive = { - case w: Work => - router.route(w, sender()) - case Terminated(a) => - router = router.removeRoutee(a) - val r = context.actorOf(Props[PrintWhatever]) - context watch r - router = router.addRoutee(r) - } -} - class PrintWhatever extends Actor { def receive = { case TickMetricSnapshot(from, to, metrics) ⇒ @@ -176,9 +141,10 @@ class PrintWhatever extends Actor { object Verifier extends App { def go: Unit = { - import scala.concurrent.duration._ import spray.client.pipelining._ + import scala.concurrent.duration._ + implicit val system = ActorSystem("test") import system.dispatcher |