Merge pull request #25951 from RayRoestenburg/wip-context-operators

SourceWithContext and FlowWithContext
This commit is contained in:
Patrik Nordwall 2019-01-18 17:27:10 +01:00 committed by GitHub
commit a920349090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 1061 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import java.util
import java.util.Optional
import akka.actor.{ ActorRef, Cancellable, Props }
import akka.annotation.ApiMayChange
import akka.event.LoggingAdapter
import akka.japi.{ Pair, Util, function }
import akka.stream._
@ -3466,4 +3467,11 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
*/
def log(name: String): javadsl.Source[Out, Mat] =
this.log(name, ConstantFun.javaIdentityFunction[Out], null)
/**
* API MAY CHANGE
*/
@ApiMayChange
def startContextPropagation[Ctx](extractContext: function.Function[Out, Ctx]): SourceWithContext[Ctx, Out, Mat] =
new scaladsl.SourceWithContext(this.asScala.map(x (x, extractContext.apply(x)))).asJava
}