Grokbase Groups Camel users May 2009
FAQ
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() ?

Thank u

Malek

Search Discussions

  • Claus Ibsen at May 14, 2009 at 4:26 pm

    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


    --
    Claus Ibsen
    Apache Camel Committer

    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • CHAHINE MALEK at May 19, 2009 at 11:37 am
    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


    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


  • Claus Ibsen at May 19, 2009 at 12:34 pm

    On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK 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 <MALEK.CHAHINE@bull.net>
    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 at May 19, 2009 at 3:34 pm
    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 wrote:
    On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK 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 <MALEK.CHAHINE@bull.net>
    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
  • Claus Ibsen at May 19, 2009 at 3:42 pm
    Hi

    Okay I think you are using file endpoints. I have found the bug and
    will commit a fix later.

    On Tue, May 19, 2009 at 5:33 PM, Claus Ibsen wrote:
    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 wrote:
    On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK 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 <MALEK.CHAHINE@bull.net>
    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


    --
    Claus Ibsen
    Apache Camel Committer

    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus
  • Claus Ibsen at May 19, 2009 at 4:04 pm
    Hi

    I created a ticket to track it
    https://issues.apache.org/activemq/browse/CAMEL-1632

    And I have commited a fix as well.

    On Tue, May 19, 2009 at 5:41 PM, Claus Ibsen wrote:
    Hi

    Okay I think you are using file endpoints. I have found the bug and
    will commit a fix later.

    On Tue, May 19, 2009 at 5:33 PM, Claus Ibsen wrote:
    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 wrote:
    On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK 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 <MALEK.CHAHINE@bull.net>
    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


    --
    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
  • S. Ali Tokmen at May 20, 2009 at 7:20 am
    Hello Claus

    Did you open a bug for this? Else, I'll show Malek how to open one :)

    Cheers

    S. Ali Tokmen
    savas-ali.tokmen@bull.net

    Office: +33 4 76 29 76 19
    GSM: +33 66 43 00 555

    Bull, Architect of an Open World TM
    http://www.bull.com



    Claus Ibsen a écrit :
    Hi

    Okay I think you are using file endpoints. I have found the bug and
    will commit a fix later.

    On Tue, May 19, 2009 at 5:33 PM, Claus Ibsen wrote:

    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 wrote:
    On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK 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 <MALEK.CHAHINE@bull.net>
    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

  • Claus Ibsen at May 22, 2009 at 4:01 pm

    On Wed, May 20, 2009 at 9:19 AM, S. Ali Tokmen wrote:
    Hello Claus

    Did you open a bug for this? Else, I'll show Malek how to open one :)
    Yes

    I created a ticket to track it
    https://issues.apache.org/activemq/browse/CAMEL-1632

    And its fixed already.

    Cheers

    S. Ali Tokmen
    savas-ali.tokmen@bull.net

    Office: +33 4 76 29 76 19
    GSM:    +33 66 43 00 555

    Bull, Architect of an Open World TM
    http://www.bull.com



    Claus Ibsen a écrit :
    Hi

    Okay I think you are using file endpoints. I have found the bug and
    will commit a fix later.


    On Tue, May 19, 2009 at 5:33 PM, Claus Ibsen <claus.ibsen@gmail.com>
    wrote:
    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 <claus.ibsen@gmail.com>
    wrote:
    On Tue, May 19, 2009 at 1:36 PM, CHAHINE MALEK <MALEK.CHAHINE@bull.net>
    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
    <MALEK.CHAHINE@bull.net>
    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



    --
    Claus Ibsen
    Apache Camel Committer

    Open Source Integration: http://fusesource.com
    Blog: http://davsclaus.blogspot.com/
    Twitter: http://twitter.com/davsclaus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupusers @
categoriescamel
postedMay 14, '09 at 4:21p
activeMay 22, '09 at 4:01p
posts9
users3
websitecamel.apache.org

People

Translate

site design / logo © 2022 Grokbase