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?


Reply via email to