2012-07-15 14:12:03 +02:00
|
|
|
package docs.camel.sample.http;
|
|
|
|
|
|
|
|
|
|
import akka.actor.*;
|
|
|
|
|
|
|
|
|
|
public class HttpSample {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
//#HttpExample
|
|
|
|
|
// Create the actors. this can be done in a Boot class so you can
|
2012-10-01 20:35:19 +02:00
|
|
|
// run the example in the MicroKernel. just add the three lines to below
|
|
|
|
|
// your boot class.
|
2012-07-15 14:12:03 +02:00
|
|
|
ActorSystem system = ActorSystem.create("some-system");
|
|
|
|
|
final ActorRef httpTransformer = system.actorOf(new Props(HttpTransformer.class));
|
|
|
|
|
|
|
|
|
|
final ActorRef httpProducer = system.actorOf(new Props(new UntypedActorFactory(){
|
|
|
|
|
public Actor create() {
|
|
|
|
|
return new HttpProducer(httpTransformer);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
ActorRef httpConsumer = system.actorOf(new Props(new UntypedActorFactory(){
|
|
|
|
|
public Actor create() {
|
|
|
|
|
return new HttpConsumer(httpProducer);
|
|
|
|
|
}
|
|
|
|
|
}));
|
|
|
|
|
//#HttpExample
|
|
|
|
|
}
|
|
|
|
|
}
|