Adds docs for actorRef stream integration #24595

This commit is contained in:
Nicolas Vollmar 2019-03-08 17:13:59 +01:00 committed by Johan Andrén
parent b8c99c5c8a
commit 44709e6bba
3 changed files with 45 additions and 0 deletions

View file

@ -770,4 +770,26 @@ public class IntegrationDocTest extends AbstractJavaTest {
}
};
}
@Test
public void illustrateSourceActorRef() throws Exception {
new TestKit(system) {
{
// #source-actorRef
int bufferSize = 10;
Source<Integer, ActorRef> source =
Source.actorRef(
bufferSize, OverflowStrategy.dropHead()); // note: backpressure is not supported
ActorRef actorRef =
source.map(x -> x * x).to(Sink.foreach(x -> System.out.println("got: " + x))).run(mat);
actorRef.tell(1, ActorRef.noSender());
actorRef.tell(2, ActorRef.noSender());
actorRef.tell(3, ActorRef.noSender());
actorRef.tell(new akka.actor.Status.Success("done"), ActorRef.noSender());
// #source-actorRef
}
};
}
}