camel docs java

This commit is contained in:
RayRoestenburg 2012-07-15 14:12:03 +02:00
parent 016eaffbfb
commit 2472e46263
39 changed files with 1479 additions and 15 deletions

View file

@ -0,0 +1,27 @@
package docs.camel;
import akka.actor.*;
import org.junit.Test;
public class OnRouteResponseTestBase {
public void onRouteResponse(){
//#RouteResponse
ActorSystem system = ActorSystem.create("some-system");
Props receiverProps = new Props(ResponseReceiver.class);
final ActorRef receiver = system.actorOf(receiverProps,"responseReceiver");
UntypedActorFactory factory = new UntypedActorFactory() {
public Actor create() {
return new Forwarder("http://localhost:8080/news/akka", receiver);
}
};
ActorRef forwardResponse = system.actorOf(new Props(factory));
// the Forwarder sends out a request to the web page and forwards the response to
// the ResponseReceiver
forwardResponse.tell("some request");
//#RouteResponse
system.stop(receiver);
system.stop(forwardResponse);
system.shutdown();
}
}