Created
December 2, 2017 23:32
-
-
Save nambrot/c9a5bf4f30ba2bc269eaec61ac880d90 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
implicit val system = ActorSystem("QuickStart") | |
implicit val materializer = ActorMaterializer() | |
def peekMatValue[T, M](src: Source[T, M]): (Source[T, M], Future[M]) = { | |
val p = Promise[M] | |
val s = src.mapMaterializedValue { m => | |
p.trySuccess(m) | |
m | |
} | |
(s, p.future) | |
} | |
val (bloodPressureSource, bloodPressureQueueFuture) = peekMatValue(Source.queue[String](100, OverflowStrategy.dropHead)) | |
val (heartRateSource, heartRateQueueFuture) = peekMatValue(Source.queue[String](100, OverflowStrategy.dropHead)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment