Skip to content

Instantly share code, notes, and snippets.

@htimur
Last active March 17, 2016 12:31
Show Gist options
  • Save htimur/11f79e2ba836c42e3da5 to your computer and use it in GitHub Desktop.
Save htimur/11f79e2ba836c42e3da5 to your computer and use it in GitHub Desktop.
def source(client: MongoClient): Source[Document, NotUsed] = {
val observable = client.getDatabase("local")
.getCollection("oplog.rs")
.find(and(
in("op", "i", "d", "u"),
exists("fromMigrate", false)))
.cursorType(CursorType.TailableAwait)
.noCursorTimeout(true)
Source.fromPublisher(observable)
}
val sources = shards.map({ shard =>
val client = MongoClient(shard.uri)
source(client)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment