I'm trying to inject Mongos capped collection enumerator into existing Concurrent.broadcast enumerator. Is it possible? Or is there a better way?
Main enumerator:
val (event, eventChannel) = Concurrent.broadcast[JsValue]
and my capped collection watcher:
def watcher : Enumerator[JsObject] = {
val futureEnumerator = collection.map { collection =>
val cursor: Cursor[JsObject] = collection
.find(Json.obj())
.options(QueryOpts().tailable.awaitData)
.cursor[JsObject]
cursor.enumerate()
}
Enumerator.flatten(futureEnumerator)
}