javafmtAll
This commit is contained in:
parent
22a78ee22f
commit
ebd181e037
1 changed files with 33 additions and 33 deletions
|
|
@ -18,50 +18,50 @@ import java.time.Duration;
|
|||
|
||||
public class ActorFlowCompileTest {
|
||||
|
||||
final ActorSystem<String> system = null;
|
||||
final ActorSystem<String> system = null;
|
||||
|
||||
static
|
||||
// #ask-actor
|
||||
class Asking {
|
||||
final String payload;
|
||||
final ActorRef<Reply> replyTo;
|
||||
static
|
||||
// #ask-actor
|
||||
class Asking {
|
||||
final String payload;
|
||||
final ActorRef<Reply> replyTo;
|
||||
|
||||
public Asking(String payload, ActorRef<Reply> replyTo) {
|
||||
this.payload = payload;
|
||||
this.replyTo = replyTo;
|
||||
}
|
||||
public Asking(String payload, ActorRef<Reply> replyTo) {
|
||||
this.payload = payload;
|
||||
this.replyTo = replyTo;
|
||||
}
|
||||
}
|
||||
|
||||
// #ask-actor
|
||||
static
|
||||
// #ask-actor
|
||||
class Reply {
|
||||
public final String msg;
|
||||
// #ask-actor
|
||||
static
|
||||
// #ask-actor
|
||||
class Reply {
|
||||
public final String msg;
|
||||
|
||||
public Reply(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
public Reply(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
||||
|
||||
// #ask-actor
|
||||
// #ask-actor
|
||||
|
||||
{
|
||||
{
|
||||
// #ask
|
||||
final ActorRef<Asking> actorRef = // ???
|
||||
// #ask
|
||||
final ActorRef<Asking> actorRef = // ???
|
||||
// #ask
|
||||
null;
|
||||
null;
|
||||
|
||||
// #ask
|
||||
Duration timeout = Duration.ofSeconds(1);
|
||||
// #ask
|
||||
Duration timeout = Duration.ofSeconds(1);
|
||||
|
||||
// method reference notation
|
||||
Flow<String, Reply, NotUsed> askFlow = ActorFlow.ask(actorRef, timeout, Asking::new);
|
||||
// method reference notation
|
||||
Flow<String, Reply, NotUsed> askFlow = ActorFlow.ask(actorRef, timeout, Asking::new);
|
||||
|
||||
// explicit creation of the sent message
|
||||
Flow<String, Reply, NotUsed> askFlowExplicit =
|
||||
ActorFlow.ask(actorRef, timeout, (msg, replyTo) -> new Asking(msg, replyTo));
|
||||
// explicit creation of the sent message
|
||||
Flow<String, Reply, NotUsed> askFlowExplicit =
|
||||
ActorFlow.ask(actorRef, timeout, (msg, replyTo) -> new Asking(msg, replyTo));
|
||||
|
||||
Source.repeat("hello").via(askFlow).map(reply -> reply.msg).runWith(Sink.seq(), system);
|
||||
// #ask
|
||||
}
|
||||
Source.repeat("hello").via(askFlow).map(reply -> reply.msg).runWith(Sink.seq(), system);
|
||||
// #ask
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue