Please excuse stupidity as this is my first Camel application
All works fine.
public class RestToBeanRouter extends RouteBuilder{
@Override
public void configure() throws Exception {
from("cxfrs://bean://rsServer")
.multicast()
.parallelProcessing()
.aggregationStrategy(new CoreSearchResponseAggregator())
.beanRef("searchRestServiceImpl", "firstMethod")
.beanRef("searchRestServiceImpl", "secondMethod")
.end()
.marshal().json(JsonLibrary.Jackson)
.to("log://camelLogger?level=DEBUG");
}
Question :
The Multicast routing expects a to
in the DSL. Currently, I am mapping this to a log
endpoint. Is this fine?
Since I am not using the to
and the last exchange of the Aggregator strategy is the one which is returned to the user, should my endpoint be configured to something else - like a null or something? (Ah, the stupidity kicks in)
For the benefit of SO visitors, copying the solution given in the Camel mailing list here :
by Robert Simmons Jr. MSc. - Lead Java Architect @ EA Author of: Hardcore Java (2003) and Maintainable Java (2012)
The aggregated exchange is the one that gets returned and how the aggregated exchange is created depends on the aggregation strategy you use. When a route stops either by calling stop or merely not routing anymore, the exchange on the last part of the route could be considered a reply. In most cases it will reply back to the caller (unless you set a reply-to destination in a JMS based route or some other cases). In your case if all you want to do is return the enriched exchange then you dont need any to() call. Just stop after the marshal.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.