camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject Re: Get The intercepted endpoint when using inetrcept()
Date Tue, 19 May 2009 11:36:23 GMT

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:



 public void process(final Exchange exchange) throws Exception {
        System.out.println("\t From Endpoint: " + 
        System.out.println("\t To Endpoint: " + 
        System.out.println("\t Intercepted File: " + 



Claus Ibsen a écrit :
> 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  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

View raw message