pekko/akka-docs/rst/java/code/docs/camel/OnRouteResponseTestBase.java

23 lines
746 B
Java
Raw Normal View History

2012-07-15 14:12:03 +02:00
package docs.camel;
import akka.actor.*;
public class OnRouteResponseTestBase {
public void onRouteResponse(){
//#RouteResponse
ActorSystem system = ActorSystem.create("some-system");
Props receiverProps = Props.create(ResponseReceiver.class);
2012-07-15 14:12:03 +02:00
final ActorRef receiver = system.actorOf(receiverProps,"responseReceiver");
ActorRef forwardResponse = system.actorOf(Props.create(
Forwarder.class, "http://localhost:8080/news/akka", receiver));
2012-07-15 14:12:03 +02:00
// the Forwarder sends out a request to the web page and forwards the response to
// the ResponseReceiver
forwardResponse.tell("some request", null);
2012-07-15 14:12:03 +02:00
//#RouteResponse
system.stop(receiver);
system.stop(forwardResponse);
system.shutdown();
}
}