Reputation: 532
I'm experimenting with akka
, and (following the documentation), I have the following code:
Source<String, NotUsed> words =
Source.from(Arrays.asList("hello", "hi"));
Timeout askTimeout = Timeout.apply(5, TimeUnit.SECONDS);
words
.mapAsync(5, elem -> ask(ref, elem, askTimeout))
.map(elem -> (String) elem)
// continue processing of the replies from the actor
.map(elem -> elem.toLowerCase())
.runWith(Sink.ignore(), materializer);
But I cannot find the "import static" directive to make the "ask method" work. I got:
Cannot resolve method ask
What i'm doing wrong? I'm using akka v 2.4 (with Java, no Scala) and following and following step by step the documentation: http://doc.akka.io/docs/akka/2.4/java/stream/stream-integrations.html
Thanks.
Upvotes: 2
Views: 1146
Reputation: 798
ask
refers to the ask Pattern.
You can use it from java using import static akka.pattern.Patterns.ask
Upvotes: 5