Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CF3D39E9E for ; Tue, 12 Jun 2012 09:34:22 +0000 (UTC) Received: (qmail 37461 invoked by uid 500); 12 Jun 2012 09:34:22 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 37365 invoked by uid 500); 12 Jun 2012 09:34:22 -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 37331 invoked by uid 99); 12 Jun 2012 09:34:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2012 09:34:20 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of zayen.f@gmail.com designates 74.125.82.173 as permitted sender) Received: from [74.125.82.173] (HELO mail-we0-f173.google.com) (74.125.82.173) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Jun 2012 09:34:13 +0000 Received: by werf3 with SMTP id f3so3426113wer.32 for ; Tue, 12 Jun 2012 02:33:52 -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:content-type; bh=OfzLXUjOKFjBSrgo/BEOq3t9sIF+bMxszBLV7O7sv58=; b=EGgjR2Xn623m1BDJkzekD3Yy4jIaNpB2ZGoo9CVsOUJjQMoYDOAAEk0qv0eJEnFBQ7 hsYXm08F1Zc3LjIZ078yrqkvGCK0D9qjwXLs99XrPYMbfz3WUrnH36YLxQ+f7vpP1Twx bSA7z/Yw13navzs5YIFQD3WBahgCA81D4cG01Xxzm/Rct0UBNmjDWuH2EZ7miiZ+F4Pm bxAXsB9l2048vAhAkgwVErnjS/PeBgwJ4wSWgMwuiQhfA6uv2ioflybZTAS9VIbK+ZTg sw0NHIH8/tZZfLyvBgA/GEknHpWEQVAIUUQ923X5k5O8wllnMOKERhPTu2xcs3+lJazC e0rg== Received: by 10.216.141.223 with SMTP id g73mr625244wej.64.1339493632407; Tue, 12 Jun 2012 02:33:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.116.83 with HTTP; Tue, 12 Jun 2012 02:33:31 -0700 (PDT) From: fradj zayen Date: Tue, 12 Jun 2012 10:33:31 +0100 Message-ID: Subject: add interceptor to a camel context To: users@camel.apache.org Content-Type: multipart/alternative; boundary=0016e6dab7002377e304c2432a51 X-Virus-Checked: Checked by ClamAV on apache.org --0016e6dab7002377e304c2432a51 Content-Type: text/plain; charset=ISO-8859-1 Hi all, I'd like to add interceptors to camel context programatically. below some code snippet Camel Context definition: CamelContext camelContext=new DefaultCamelContext(); RouteDefinition routeDefinition=new RouteDefinition(); routeDefinition.from("direct:a").to("direct:b").to("direct:c"); camelContext.getRouteDefinitions().add(routeDefinition); camelContext.setTracing(true); camelContext.start(); Interceptor to be used: InterceptSendToEndpointDefinition interceptor=new InterceptSendToEndpointDefinition( "direct:b"); interceptor.process(new Processor() { public void process(Exchange exchange) throws Exception { System.out.println(exchange); } }); interceptor.to("log:intercepted ${body}"); interceptor.end(); I used the following configuration to add the interceptor to the camel context, but the interceptor is not fired when an exchange is sent to the intercepted endpoint ((ModelCamelContext) camelContext).getRouteDefinitions()..get(0).getOutputs().add( interceptor); Can someone help on this? thanks for your help --0016e6dab7002377e304c2432a51--