Add setup operator #26192
This commit is contained in:
parent
7b20b89ce0
commit
18d970fc8e
14 changed files with 574 additions and 4 deletions
|
|
@ -26,7 +26,7 @@ import scala.concurrent.{ Future, Promise }
|
|||
import scala.compat.java8.OptionConverters._
|
||||
import java.util.concurrent.CompletionStage
|
||||
import java.util.concurrent.CompletableFuture
|
||||
import java.util.function.Supplier
|
||||
import java.util.function.{ BiFunction, Supplier }
|
||||
|
||||
import akka.util.unused
|
||||
import com.github.ghik.silencer.silent
|
||||
|
|
@ -359,6 +359,14 @@ object Source {
|
|||
case other => new Source(scaladsl.Source.fromGraph(other))
|
||||
}
|
||||
|
||||
/**
|
||||
* Defers the creation of a [[Source]] until materialization. The `factory` function
|
||||
* exposes [[ActorMaterializer]] which is going to be used during materialization and
|
||||
* [[Attributes]] of the [[Source]] returned by this method.
|
||||
*/
|
||||
def setup[T, M](factory: BiFunction[ActorMaterializer, Attributes, Source[T, M]]): Source[T, CompletionStage[M]] =
|
||||
scaladsl.Source.setup((mat, attr) ⇒ factory(mat, attr).asScala).mapMaterializedValue(_.toJava).asJava
|
||||
|
||||
/**
|
||||
* Combines several sources with fan-in strategy like `Merge` or `Concat` and returns `Source`.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue