Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id E2398200BA1 for ; Mon, 17 Oct 2016 15:03:48 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E10DC160AEC; Mon, 17 Oct 2016 13:03:48 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 348D5160AE5 for ; Mon, 17 Oct 2016 15:03:48 +0200 (CEST) Received: (qmail 52146 invoked by uid 500); 17 Oct 2016 13:03:47 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 52134 invoked by uid 99); 17 Oct 2016 13:03:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Oct 2016 13:03:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 6B2FF1A0642 for ; Mon, 17 Oct 2016 13:03:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.38 X-Spam-Level: ** X-Spam-Status: No, score=2.38 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, WEIRD_PORT=0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id bOEd9a1IHeyH for ; Mon, 17 Oct 2016 13:03:45 +0000 (UTC) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 1D5705FAC8 for ; Mon, 17 Oct 2016 13:03:45 +0000 (UTC) Received: by mail-lf0-f42.google.com with SMTP id b81so284467759lfe.1 for ; Mon, 17 Oct 2016 06:03:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=eP8iexw4YrVwQVQk27RiWu4e/8WXvkTpoY0ilCSGp10=; b=LdCyZJi253n6Vc+HJc2kAwsEXlekbT7xDlMsdsqI1qSnZPvF+yXI+tZ04EcbL5tIzg tYqJ/0eGPyw9LfFEughSZOXrZK11mBqgDlNW0SnmUiq23dJ/HyRyE9vJoh9lwKnZojJM vZwRshb/aikMr6/Zm3XbloETnSYJHW5NroI25yDRR3LiuxS+dZWz1CEYQH7DUEFMXz1c 8JwouBvxAxZA+28sQF11F+u2IkVlhndjx4j2PROVWK2fj/mwrPqBVWQ3o92VcljJMuWM 2+VwmxZe+/r1XaOMtTlNae2o1gd/NFKNEX5P1RWEFE2tFTQhw70K3oEKv35+9htlO/xz RKXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=eP8iexw4YrVwQVQk27RiWu4e/8WXvkTpoY0ilCSGp10=; b=W91v6WqSr2qieJiV3BapfJQ7NKQmOGF7b1RMjN9hubAo6I7nB8PCuVnaB2EEnCYCLZ n6McU2gFxa9Ahm+/AchR9Mr402za4Fo0QUV/cQge8edl0haN47TS54cN0ll/1sfdrJkW ct/iA9qnZxinXcq8D/KMLKCjW2pJ34hPQDJSbzZLuZhwkGLqvu1QE+zMK2KWBYJHrPxc sUjk/MdtGE45c5o4etbE7ek3pN4leEeaMrxXKbFjK4ZnvFzvPPDxD0c305jKWyJajY+g zxvOyTZ687QOtaAQHOisI7PyDan5ljKTqkON3ea5HuSGO6MF05Bmvtn8LWOLo0uW5zeA 5E9g== X-Gm-Message-State: AA6/9RkTCpCfzrXFOSNedE0uvjT/JJk2lUzE+fOH848Dd4RxKifMWPKvrsQ+KeWS4X7vpTQ6ljmuaiGUCHbiag== X-Received: by 10.25.199.76 with SMTP id x73mr14704457lff.162.1476709423513; Mon, 17 Oct 2016 06:03:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.160.136 with HTTP; Mon, 17 Oct 2016 06:03:42 -0700 (PDT) From: Debraj Manna Date: Mon, 17 Oct 2016 18:33:42 +0530 Message-ID: Subject: Content Based Routing based on JSON Request Body To: users@camel.apache.org Content-Type: multipart/alternative; boundary=94eb2c1a1a66a005f9053f0f34e2 archived-at: Mon, 17 Oct 2016 13:03:49 -0000 --94eb2c1a1a66a005f9053f0f34e2 Content-Type: text/plain; charset=UTF-8 Hi 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:- from("jetty:http://localhost:8888/hello").unmarshal().json(JsonLibrary. Jackson, RouteRequest.class) .choice() .when(method(DynamicRouter.class, "route").isEqualTo("getHello")).to( "stream:out") .otherwise() .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 isEqualTo("getHello")).to("stream:out") Can someone let me know what I am doing wrong? Thanks, --94eb2c1a1a66a005f9053f0f34e2--