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,25 @@
package docs.camel;
//#CustomRoute
import akka.actor.UntypedActor;
import akka.camel.CamelMessage;
import akka.japi.Function;
public class Responder extends UntypedActor{
public void onReceive(Object message) {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
getSender().tell(createResponse(camelMessage));
} else
unhandled(message);
}
private CamelMessage createResponse(CamelMessage msg) {
return msg.mapBody(new Function<String,String>() {
public String apply(String body) {
return String.format("received %s", body);
}
});
}
}
//#CustomRoute