Initial SourceWithContext, FlowWithContext, FlowWithContextOps.

(based on https://github.com/akka/akka/compare/master...jrudolph:jr/withContextOps)
This commit is contained in:
Raymond Roestenburg 2018-11-16 15:00:30 +01:00
parent fee98217e6
commit d76d259408
10 changed files with 727 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 javadsl.SourceWithContext(scaladsl.SourceWithContext(this.asScala).mapContext(extractContext.apply))
}