pekko/akka-docs/rst/java/code/jdocs/camel/OnRouteResponseTestBase.java
Hawstein 6434cbe868 Re-implement javadsl testkit (#22240)
* re-implement javadsl testkit

* fix mima problem

* rebase master

* move ImplicitSender/DefaultTimeout to scaladsl

* undo the change of moving scala api

* fix return type and add doc

* resolve conflicts and add more comments
2017-03-16 20:02:47 +01:00

23 lines
817 B
Java

package jdocs.camel;
import akka.actor.*;
import akka.testkit.javadsl.TestKit;
public class OnRouteResponseTestBase {
public void onRouteResponse(){
//#RouteResponse
ActorSystem system = ActorSystem.create("some-system");
Props receiverProps = Props.create(ResponseReceiver.class);
final ActorRef receiver = system.actorOf(receiverProps,"responseReceiver");
ActorRef forwardResponse = system.actorOf(Props.create(
Forwarder.class, "http://localhost:8080/news/akka", receiver));
// the Forwarder sends out a request to the web page and forwards the response to
// the ResponseReceiver
forwardResponse.tell("some request", ActorRef.noSender());
//#RouteResponse
system.stop(receiver);
system.stop(forwardResponse);
TestKit.shutdownActorSystem(system);
}
}