Since 2.6 i get deprecation warning on this line:
import akka.stream.ActorMaterializer
implicit val actorMaterializer = ActorMaterializer()
Warning:
method apply in object ActorMaterializer is deprecated (since 2.6.0): Use the system wide materializer with stream attributes or configuration settings to change defaults
I don't understand that message, what am i supposed to do? What's 'system wide materializer', it it located in some akka package?
ActorMaterializer is responsible for providing materialization to the Akka Toolkit. It will create all the required Actors under the hood and take care of executing the data streams with defined functionality. It needs the ActorSystem to create and manage those Actors.
Akka streams consist of 3 major components in it – Source, Flow, Sink – and any non-cyclical stream consist of at least 2 components Source, Sink and any number of Flow element.
In other words, data flows through the graph as a response to demand from receivers. Producers then comply and send more elements downstream. A second (transparent) protocol kicks in when production of elements is faster than demand. This protocol (backpressure) slows down the producers and ensures no data is lost.
Actor Materializer Lifecycle. The Materializer is a component that is responsible for turning the stream blueprint into a running stream and emitting the “materialized value”.
It's not needed anymore. But you have to have an implicit
of ActorSystem
available in your context.
implicit val actorSystem = ActorSystem()
Then the materializer is implicitly derived from ActorSystem
in akka.stream.Materializer
/**
* Implicitly provides the system wide materializer from a classic or typed `ActorSystem`
*/
implicit def matFromSystem(implicit provider: ClassicActorSystemProvider): Materializer =
SystemMaterializer(provider.classicSystem).materializer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With