package couchdb.changes
import akka.actor._
import spray.http.Uri
import com.typesafe.config.ConfigFactory
object LoggingActor extends Actor with ActorLogging {
log.info("Initializing LoggingActor")
def receive: Receive = {
case x => log.info("Received {}", x)
}
}
object Example extends App with settings {
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"
)
}
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
}
}
// vim: set ts=2 sw=2 et: