Created
May 31, 2017 19:59
-
-
Save anonymous/cf1e5cdb071162b6bdcdc034e1510aaf to your computer and use it in GitHub Desktop.
the description for this gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
monixObservable | |
.mapAsync(1) { | |
case CommitableMsg(MsgA(a), offset) => | |
someBusinessTask(a).map(_ => offset) | |
case CommitableMsg(_, offset) => | |
Task.now(offset) | |
} | |
.bufferTimedAndCounted(1.second, 100) | |
.filter(_.nonEmpty) | |
.mapAsync(1)(offsets => Task.fromFuture(offsets.last.commitOffset)) | |
.takeWhileNotCanceled(injectedCancellable) | |
.consumeWith(Consumer.complete) | |
.runAsync(monix.execution.Scheduler.computation()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment