DISCLAIMER: The whole content is copied from This awesome answer
To prevent lost of such useful content as the original question was too broad for SO
Full credit: content author sschaef
If you find this copied content offensive in anyway, please email me
This answer is based on akka-stream
version 2.4.2
. The API can be slightly different in other versions. The dependency can be consumed by [sbt][1]: