camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Debraj Manna <>
Subject Content Based Routing based on JSON Request Body
Date Mon, 17 Oct 2016 13:03:42 GMT

I have a camel REST endpoint which receives a request of the form:-

{"method" : "getHello"}

Based on the value in the method field in the request body I want to route
the request to different routes. So I tried something like this below:-

Jackson, RouteRequest.class)


.when(method(DynamicRouter.class, "route").isEqualTo("getHello")).to(


.log("Processing Failed");

Dynamic Router class is like below:-

public class DynamicRouter {

public String route(RouteRequest req) {

switch (req.getMethod()) {

case "getHello":

return "xxxx";


return null;



Even though I am returning xxxx from route() but the below Predicate is
always evaluating to true and it is never going to .otherwise


Can someone let me know what I am doing wrong?


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message