src/main/scala/Example.scala
changeset 4 b25c02bd6b11
parent 2 04af787ba66f
--- a/src/main/scala/Example.scala	Thu Nov 19 18:36:56 2015 +0100
+++ b/src/main/scala/Example.scala	Thu Nov 19 19:08:18 2015 +0100
@@ -2,7 +2,6 @@
 
 import akka.actor._
 import spray.http.Uri
-import com.typesafe.config.ConfigFactory
 
 object LoggingActor extends Actor with ActorLogging {
   log.info("Initializing LoggingActor")
@@ -11,28 +10,25 @@
   }
 }
 
-object Example extends App with settings {
+case object Start
+
+object Example extends App {
 
   val system = ActorSystem()
   val stream = system.actorOf(Props(new ChangesStreamActor(
     system.actorOf(Props(LoggingActor)))))
 
-  def config = ConfigFactory.load()
-
-  stream ! Uri(s"${couchConf.url}/_changes").withQuery(
-    "feed" -> "continuous"
-  , "heartbeat" -> couchConf.heartbeat.toMillis.toString
-  , "include_docs" -> "true"
-  )
-
+  stream ! Start
 }
 
 import com.wacai.config.annotation._
 import scala.concurrent.duration._
+
 @conf trait settings extends Configurable {
   val couchConf = new {
     val url = "http://localhost:5984/example"
     val heartbeat = 5 seconds
+    val reconnect = 45 seconds
   }
 }