|
0
|
1 |
package couchdb.changes
|
|
|
2 |
|
|
|
3 |
import akka.actor._
|
|
|
4 |
import spray.http.Uri
|
|
|
5 |
|
|
|
6 |
object LoggingActor extends Actor with ActorLogging {
|
|
|
7 |
log.info("Initializing LoggingActor")
|
|
|
8 |
def receive: Receive = {
|
|
|
9 |
case x => log.info("Received {}", x)
|
|
|
10 |
}
|
|
|
11 |
}
|
|
|
12 |
|
|
|
13 |
object Example extends App {
|
|
|
14 |
|
|
|
15 |
val system = ActorSystem()
|
|
|
16 |
val stream = system.actorOf(Props(new ChangesStreamActor(
|
|
|
17 |
system.actorOf(Props(LoggingActor)))))
|
|
|
18 |
|
|
|
19 |
stream ! Uri("http://localhost:5984/example/_changes").withQuery(
|
|
|
20 |
"feed" -> "continuous"
|
|
|
21 |
, "heartbeat" -> "5000"
|
|
|
22 |
, "include_docs" -> "true"
|
|
|
23 |
)
|
|
|
24 |
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
// vim: set ts=2 sw=2 et:
|