Hi What is the URI of the source and the target?
I have created an unit test and it works using direct and mock endpoints. So I want to know if it can be an issue if you use other kind of endpoints. On Tue, May 19, 2009 at 2:33 PM, Claus Ibsen <[email protected]> wrote: > On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK <[email protected]> wrote: >> Hi >> >> I used the interceptSendToEndpoint(), and I am able to get the destination >> endpoint by using Exchange.INTERCEPTED_ENDPOINT, but I need also to get the >> sender endpoint, I tried to get it by exchange.getFromEndpoint(), it >> 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( >> target.toURI().toString()); >> >> >> public void process(final Exchange exchange) throws Exception { >> System.out.println("\t From Endpoint: " + exchange.getFromEndpoint()); >> System.out.println("\t To Endpoint: " + >> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT)); >> System.out.println("\t Intercepted File: " + >> exchange.getIn().getHeader("CamelFileNameOnly")); >> } >> >> 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 écrit : >>> >>> On Thu, May 14, 2009 at 6:20 PM, CHAHINE MALEK <[email protected]> >>> 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 i use the intercept(), i don't find the intercepted Endpoint in >>>> the >>>> message header Exchange.INTERCEPTED_ENDPOINT. >>>> >>>> In my case I need to intercept all exchanges while they are on route, so >>>> 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 >>>> >>>> >>>> >>> >>> >>> >>> >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
