Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 24694 invoked from network); 19 May 2009 12:34:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 19 May 2009 12:34:50 -0000 Received: (qmail 69841 invoked by uid 500); 19 May 2009 12:34:50 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 69811 invoked by uid 500); 19 May 2009 12:34:50 -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 69800 invoked by uid 99); 19 May 2009 12:34:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 May 2009 12:34:50 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.226 as permitted sender) Received: from [209.85.218.226] (HELO mail-bw0-f226.google.com) (209.85.218.226) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 19 May 2009 12:34:35 +0000 Received: by bwz26 with SMTP id 26so3838765bwz.20 for ; Tue, 19 May 2009 05:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=J70LlDVlvgZCr0cgqgcQ/fI7D1G9ysmSG5kjpkNQrVU=; b=wNj/2kagpGk9kHJgeqRZkgM7VasjWZxcgNT/AOA0oS/JPPDJUj1v6P2PitWkP1fh4e j5MYq0U032L5JwC0ZmLAixmg6+UqFUpEj4XC9W+3FE6N1Y3Rht0PbG/uCTQVY5RLh0C1 FfRa0b7iNipTxGA1CgRKbTUNV06qPCDyxk4mg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=qGW1ivTYktYJ1tF/n4V+OEE2xRYVLTmXrq3xyqmk326VIAYv4AozfTcWuXTnWhUb4U r3PgSqcSndAHvU3OiVZh7qT5M1qRd8ckQJae/CA2yEfbXHczeRo9bEvSY0nFNoS90Yzx lzqFhAyCxA5ApSg6FiOVjyun1eyxmhD3JyLBs= MIME-Version: 1.0 Received: by 10.204.60.133 with SMTP id p5mr7878736bkh.143.1242736454314; Tue, 19 May 2009 05:34:14 -0700 (PDT) In-Reply-To: <4A1299B7.8050409@BULL.NET> References: <4A0C44E2.2020705@BULL.NET> <5380c69c0905140926n1e356285p833f3bb668d9c511@mail.gmail.com> <4A1299B7.8050409@BULL.NET> From: Claus Ibsen Date: Tue, 19 May 2009 14:33:53 +0200 Message-ID: <5380c69c0905190533p68957d7fs91a896aac7766e91@mail.gmail.com> Subject: Re: Get The intercepted endpoint when using inetrcept() To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK wro= te: > Hi > > I used the interceptSendToEndpoint(), and I am able to get the destinatio= n > endpoint by using Exchange.INTERCEPTED_ENDPOINT, but I need also to get t= he > sender endpoint, I tried to get it by =A0exchange.getFromEndpoint(), =A0i= t > returns always null. > > Do you have an idea how can i get the sender endpoint ? > > I'm using the following code: > > this.interceptSendToEndpoint(target.toURI().toString()).process(new > InterceptorProcessor()); > > this.from(source.toURI().toString()).setHeader(Exchange.FILE_NAME, > this.constant("report.txt")).to( > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 target.toURI().toStri= ng()); > > > public void process(final Exchange exchange) throws Exception { > =A0 =A0 =A0 System.out.println("\t From Endpoint: " + exchange.getFromEnd= point()); > =A0 =A0 =A0 System.out.println("\t To Endpoint: " + > exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT)); > =A0 =A0 =A0 System.out.println("\t Intercepted File: " + > exchange.getIn().getHeader("CamelFileNameOnly")); > =A0 } > > Thanks > > Malek Hi Marek Can you create a JIRA ticket for this. Then I wont forget to look into it. I have a few other things to attend but then I will take a look. > > > Claus Ibsen a =E9crit : >> >> On Thu, May 14, 2009 at 6:20 PM, CHAHINE MALEK >> wrote: >> >>> >>> Hi, >>> >>> I use camel 2.0 in my project, and I need to intercept all exchanges >>> while >>> they are on route. >>> >>> For each intercepted exchange I need to log his message body and the >>> intercepted Endpoint. >>> >>> I can get the intercepted Endpoint in the message header >>> Exchange.INTERCEPTED_ENDPOINT, when I used interceptSendToEndpoint. >>> >>> But if =A0i use the intercept(), =A0i don't find the intercepted Endpoi= nt in >>> the >>> message header Exchange.INTERCEPTED_ENDPOINT. >>> >>> In my case I need to intercept all exchanges while they are on route, s= o >>> I >>> need to use intercept(). >>> How can I get the intercepted Endpoint when using inetrcept() ? >>> >> >> Hi >> >> While an Exchange is being routed in Camel it passes through a graph >> of processors. These processors are not all endpoints, so while you >> intercept() its not all endpoints, for instance a delay() is a just a >> processor that delays the message. >> >> INTERCEPTED_ENDPOINT is used by the interceptSendToEndpoint, eg when >> clearly you are *about* to send an Exchange to an Endpoint. So why its >> there. >> The same applies for interceptFrom() as it intercept any *incoming* >> exchange coming in from an input Endpoint. >> >> So the intercept() has no notion of endpoint as it intercepts each and >> evert step the Exchange take is the route graph. You can however get >> the incoming endpoint, eg where it was constructed, by >> exchange.getFromEndpoin(). This might be the endpoint you are looking >> for. >> >> >> >>> >>> Thank u >>> Malek >>> >>> >>> >> >> >> >> > > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus