|
Akka/Scala example source code file (Responder.java)
The Responder.java Akka example source codepackage docs.camel; //#CustomRoute import akka.actor.UntypedActor; import akka.camel.CamelMessage; import akka.dispatch.Mapper; 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), getSelf()); } else unhandled(message); } private CamelMessage createResponse(CamelMessage msg) { return msg.mapBody(new Mapper<String,String>() { @Override public String apply(String body) { return String.format("received %s", body); } }); } } //#CustomRoute Other Akka source code examplesHere is a short list of links related to this Akka Responder.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.