Skip to content

Instantly share code, notes, and snippets.

@NicolaeNMV
Created May 29, 2015 12:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicolaeNMV/d3d9d9958b7769e8d48a to your computer and use it in GitHub Desktop.
Save NicolaeNMV/d3d9d9958b7769e8d48a to your computer and use it in GitHub Desktop.
reactive-stream FlowMaterializer

If you were playing with reactive-stream, and you got this error

scala> val sum = source.runWith(sink)
<console>:14: error: could not find implicit value for parameter materializer: akka.stream.FlowMaterializer

You need an implicit FlowMaterializer

def runWith[Mat2](sink: Graph[SinkShape[Out], Mat2])(implicit materializer: FlowMaterializer): Mat2

runWith expects an implicit that implements the abstract class FlowMaterializer. You can use ActorFlowMaterializer.

import akka.actor.ActorSystem
import akka.stream.ActorFlowMaterializer

implicit val system = ActorSystem("Sys")
implicit val materializer = ActorFlowMaterializer()

Ref:

http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-RC3/scala/stream-quickstart.html#stream-quickstart-scala

https://github.com/typesafehub/activator-akka-stream-scala/blob/master/src/main/scala/sample/stream/BasicTransformation.scala

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment