Akka:Stream:Keep
lastmod 2020-09-24created 2020-09-241 edits
Keep in akka-stream
About
Every stream processing stage can produce a materialized value, which can be captured using viaMat or toMat (as opposed to via() or to(), respectively). In your code snippet, using source.toMat(sink) indicates that you're interested in capturing the materialized values of the source and the sink, and
-
Keep.rightkeeps the right side (i.e., the sink) of the materialized value. -
Keep.leftkeeps the materialized value on the left (i.e., the source), and -
Keep.bothlets you keep both.