|
Akka/Scala example source code file (RouteConsumer.java)
The RouteConsumer.java Akka example source code
package sample.camel.route;
import akka.actor.ActorRef;
import akka.camel.CamelMessage;
import akka.camel.javaapi.UntypedConsumerActor;
public class RouteConsumer extends UntypedConsumerActor {
private ActorRef transformer;
public RouteConsumer(ActorRef transformer) {
this.transformer = transformer;
}
public String getEndpointUri() {
return "jetty:http://0.0.0.0:8877/camel/welcome";
}
public void onReceive(Object message) {
if (message instanceof CamelMessage) {
CamelMessage camelMessage = (CamelMessage) message;
// Forward a string representation of the message body to transformer
String body = camelMessage.getBodyAs(String.class, getCamelContext());
transformer.forward(camelMessage.withBody(body), getContext());
} else
unhandled(message);
}
}
Other Akka source code examplesHere is a short list of links related to this Akka RouteConsumer.java source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 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.