27

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?

Epicurist
  • 3
  • 1
Alexander Kondaurov
  • 3,677
  • 5
  • 42
  • 64

1 Answers1

44

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
Ivan Stanislavciuc
  • 7,140
  • 15
  • 18