2012-07-15 14:12:03 +02:00
|
|
|
package docs.camel;
|
|
|
|
|
|
|
|
|
|
import akka.actor.*;
|
2013-05-02 17:12:36 +02:00
|
|
|
import akka.testkit.JavaTestKit;
|
2012-07-15 14:12:03 +02:00
|
|
|
|
|
|
|
|
public class OnRouteResponseTestBase {
|
|
|
|
|
|
|
|
|
|
public void onRouteResponse(){
|
|
|
|
|
//#RouteResponse
|
|
|
|
|
ActorSystem system = ActorSystem.create("some-system");
|
2013-04-14 22:56:41 +02:00
|
|
|
Props receiverProps = Props.create(ResponseReceiver.class);
|
2012-07-15 14:12:03 +02:00
|
|
|
final ActorRef receiver = system.actorOf(receiverProps,"responseReceiver");
|
2013-04-14 22:56:41 +02:00
|
|
|
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
|
2012-09-19 23:55:53 +02:00
|
|
|
forwardResponse.tell("some request", null);
|
2012-07-15 14:12:03 +02:00
|
|
|
//#RouteResponse
|
|
|
|
|
system.stop(receiver);
|
|
|
|
|
system.stop(forwardResponse);
|
2013-05-02 17:12:36 +02:00
|
|
|
JavaTestKit.shutdownActorSystem(system);
|
2012-07-15 14:12:03 +02:00
|
|
|
}
|
|
|
|
|
}
|