0

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)
  }
PsychoX
  • 1,088
  • 4
  • 21
  • 43

1 Answers1

0

What I was looking for is >-:

val combinedStreams = event >- watcher
cchantep
  • 9,118
  • 3
  • 30
  • 41
PsychoX
  • 1,088
  • 4
  • 21
  • 43