Error handling with recipientList

classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|

Error handling with recipientList

Marco Crivellaro
I ha following route


onException(GenericFileOperationFailedException.class)
        .process(new DeliveryFailureHandler()).stop();
                               
                               
from("test-jms:queue:feed.notificationtest.queue")
        .process(processor)
        .recipientList(header("recipientListHeader").tokenize(","));


recipientListHeader contains a cvs list of endpoints (FTP)
how can I detect the endpoint URI causing the exception?
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
On Wed, Nov 4, 2009 at 2:40 PM, mcrive <[hidden email]> wrote:

>
> I ha following route
>
>
> onException(GenericFileOperationFailedException.class)
>        .process(new DeliveryFailureHandler()).stop();
>
>
> from("test-jms:queue:feed.notificationtest.queue")
>        .process(processor)
>        .recipientList(header("recipientListHeader").tokenize(","));
>
>
> recipientListHeader contains a cvs list of endpoints (FTP)
> how can I detect the endpoint URI causing the exception?
> --

What version are you using? This is important to know.

In 2.1-SNAPSHOT you can get it using a property on the exchange

String uri = exchange.getProperty(Exchange.FAILURE_ENDPOINT, String.class);



> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26196454.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
thank you for such a quick reply!

I am currently using 2.0 REL, is there a way to do the same thing with the version I have?

Claus Ibsen-2 wrote
On Wed, Nov 4, 2009 at 2:40 PM, mcrive <mcrive@optasportsdata.com> wrote:
>
> I ha following route
>
>
> onException(GenericFileOperationFailedException.class)
>        .process(new DeliveryFailureHandler()).stop();
>
>
> from("test-jms:queue:feed.notificationtest.queue")
>        .process(processor)
>        .recipientList(header("recipientListHeader").tokenize(","));
>
>
> recipientListHeader contains a cvs list of endpoints (FTP)
> how can I detect the endpoint URI causing the exception?
> --

What version are you using? This is important to know.

In 2.1-SNAPSHOT you can get it using a property on the exchange

String uri = exchange.getProperty(Exchange.FAILURE_ENDPOINT, String.class);



> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26196454.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
On Wed, Nov 4, 2009 at 2:48 PM, mcrive <[hidden email]> wrote:
>
> thank you for such a quick reply!
>
> I am currently using 2.0 REL, is there a way to do the same thing with the
> version I have?
>

You can use interceptSendToEndpoint
http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-interceptors-round.html
And see more details at the Camel documentation (link from above)


And then have it decorate with a custom header what the endpoint is.
That you can retrieve in your error processor.

The intercepted endpoint is stored in the IN message header as:
Exchange.INTERCEPTED_ENDPOINT



>
> Claus Ibsen-2 wrote:
>>
>> On Wed, Nov 4, 2009 at 2:40 PM, mcrive <[hidden email]> wrote:
>>>
>>> I ha following route
>>>
>>>
>>> onException(GenericFileOperationFailedException.class)
>>>        .process(new DeliveryFailureHandler()).stop();
>>>
>>>
>>> from("test-jms:queue:feed.notificationtest.queue")
>>>        .process(processor)
>>>        .recipientList(header("recipientListHeader").tokenize(","));
>>>
>>>
>>> recipientListHeader contains a cvs list of endpoints (FTP)
>>> how can I detect the endpoint URI causing the exception?
>>> --
>>
>> What version are you using? This is important to know.
>>
>> In 2.1-SNAPSHOT you can get it using a property on the exchange
>>
>> String uri = exchange.getProperty(Exchange.FAILURE_ENDPOINT,
>> String.class);
>>
>>
>>
>>> View this message in context:
>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26196454.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26196600.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
I've configured following route:

interceptSendToEndpoint("*").process(new SendToEndPointHandler());
                               
onException(GenericFileOperationFailedException.class)
        .process(new DeliveryFailureHandler());
                                                               
from("test-jms:queue:notificationtest.queue")
        .process(processor)
        .recipientList(header("recipientListHeader").tokenize(","));



SendToEndPointHandler does following on process method:
String deliveryEndPoint = exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
Message camel_reply = exchange.getIn();
camel_reply.setHeader("current-endpoint", deliveryEndPoint);
exchange.setOut(camel_reply);



unfortunately on DeliveryFailureHandler I am not seeing the new injected header...
what am I missing?




Claus Ibsen-2 wrote
You can use interceptSendToEndpoint
http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-interceptors-round.html
And see more details at the Camel documentation (link from above)


And then have it decorate with a custom header what the endpoint is.
That you can retrieve in your error processor.

The intercepted endpoint is stored in the IN message header as:
Exchange.INTERCEPTED_ENDPOINT
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
On Wed, Nov 4, 2009 at 5:12 PM, mcrive <[hidden email]> wrote:

>
> I've configured following route:
>
> interceptSendToEndpoint("*").process(new SendToEndPointHandler());
>
> onException(GenericFileOperationFailedException.class)
>        .process(new DeliveryFailureHandler());
>
> from("test-jms:queue:notificationtest.queue")
>        .process(processor)
>        .recipientList(header("recipientListHeader").tokenize(","));
>
>
> SendToEndPointHandler does following on process method:
> String deliveryEndPoint =
> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
> Message camel_reply = exchange.getIn();
> camel_reply.setHeader("current-endpoint", deliveryEndPoint);


Remove this one line below as you do not want to change the exchange
pattern. All you wanted to do was to add that 1 extra header on the IN
message.


> exchange.setOut(camel_reply);
>
>
> unfortunately on DeliveryFailureHandler I am not seeing the new injected
> header...
> what am I missing?
>
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> You can use interceptSendToEndpoint
>> http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-interceptors-round.html
>> And see more details at the Camel documentation (link from above)
>>
>>
>> And then have it decorate with a custom header what the endpoint is.
>> That you can retrieve in your error processor.
>>
>> The intercepted endpoint is stored in the IN message header as:
>> Exchange.INTERCEPTED_ENDPOINT
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26199328.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
Even by removing the exchange.setOut I am not seeing the header I've added when checking the exchange In message on the exception processor.

this is my current process for interceptSendToEndpoint:
public void process(Exchange exchange) throws Exception {
 String deliveryEndPoint = exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
 Message camel_reply = exchange.getIn();
 camel_reply.setHeader("current-endpoint", deliveryEndPoint);
}



I did a small test by changing the body on each intercept process and when the exception is thrown I
see the original body of the message and not the one I've changed, it looks like I am looking into the wrong thing in the exception processor:

public void process(Exchange exchange) throws Exception {
        Throwable caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class);
       
        Message inMsg = exchange.getIn();
        //inMsg body is the original one and not the one that has been modified by the interceptor.
       
}




Claus Ibsen-2 wrote
On Wed, Nov 4, 2009 at 5:12 PM, mcrive <mcrive@optasportsdata.com> wrote:
>
> I've configured following route:
>
> interceptSendToEndpoint("*").process(new SendToEndPointHandler());
>
> onException(GenericFileOperationFailedException.class)
>        .process(new DeliveryFailureHandler());
>
> from("test-jms:queue:notificationtest.queue")
>        .process(processor)
>        .recipientList(header("recipientListHeader").tokenize(","));
>
>
> SendToEndPointHandler does following on process method:
> String deliveryEndPoint =
> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
> Message camel_reply = exchange.getIn();
> camel_reply.setHeader("current-endpoint", deliveryEndPoint);


Remove this one line below as you do not want to change the exchange
pattern. All you wanted to do was to add that 1 extra header on the IN
message.


> exchange.setOut(camel_reply);
>
>
> unfortunately on DeliveryFailureHandler I am not seeing the new injected
> header...
> what am I missing?
>
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> You can use interceptSendToEndpoint
>> http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-interceptors-round.html
>> And see more details at the Camel documentation (link from above)
>>
>>
>> And then have it decorate with a custom header what the endpoint is.
>> That you can retrieve in your error processor.
>>
>> The intercepted endpoint is stored in the IN message header as:
>> Exchange.INTERCEPTED_ENDPOINT
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26199328.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
Hi

See this unit test I just added for inspiration, showing how to do it
in 2.0 and in the future in 2.1 where you got the headers already for
free.
http://svn.apache.org/viewvc?rev=833011&view=rev


On Wed, Nov 4, 2009 at 6:05 PM, mcrive <[hidden email]> wrote:

>
> Even by removing the exchange.setOut I am not seeing the header I've added
> when checking the exchange In message on the exception processor.
>
> this is my current process for interceptSendToEndpoint:
> public void process(Exchange exchange) throws Exception {
>  String deliveryEndPoint =
> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
>  Message camel_reply = exchange.getIn();
>  camel_reply.setHeader("current-endpoint", deliveryEndPoint);
> }
>
>
> I did a small test by changing the body on each intercept process and when
> the exception is thrown I
> see the original body of the message and not the one I've changed, it looks
> like I am looking into the wrong thing in the exception processor:
>
> public void process(Exchange exchange) throws Exception {
>        Throwable caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT,
> Throwable.class);
>
>        Message inMsg = exchange.getIn();
>        //inMsg body is the original one and not the one that has been
> modified by the interceptor.
>
> }
>
>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Wed, Nov 4, 2009 at 5:12 PM, mcrive <[hidden email]> wrote:
>>>
>>> I've configured following route:
>>>
>>> interceptSendToEndpoint("*").process(new SendToEndPointHandler());
>>>
>>> onException(GenericFileOperationFailedException.class)
>>>        .process(new DeliveryFailureHandler());
>>>
>>> from("test-jms:queue:notificationtest.queue")
>>>        .process(processor)
>>>        .recipientList(header("recipientListHeader").tokenize(","));
>>>
>>>
>>> SendToEndPointHandler does following on process method:
>>> String deliveryEndPoint =
>>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT).toString();
>>> Message camel_reply = exchange.getIn();
>>> camel_reply.setHeader("current-endpoint", deliveryEndPoint);
>>
>>
>> Remove this one line below as you do not want to change the exchange
>> pattern. All you wanted to do was to add that 1 extra header on the IN
>> message.
>>
>>
>>> exchange.setOut(camel_reply);
>>>
>>>
>>> unfortunately on DeliveryFailureHandler I am not seeing the new injected
>>> header...
>>> what am I missing?
>>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> You can use interceptSendToEndpoint
>>>> http://davsclaus.blogspot.com/2009/05/on-road-to-camel-20-interceptors-round.html
>>>> And see more details at the Camel documentation (link from above)
>>>>
>>>>
>>>> And then have it decorate with a custom header what the endpoint is.
>>>> That you can retrieve in your error processor.
>>>>
>>>> The intercepted endpoint is stored in the IN message header as:
>>>> Exchange.INTERCEPTED_ENDPOINT
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26199328.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26200307.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
In reply to this post by Marco Crivellaro
in following route

interceptSendToEndpoint("*").process(new SendToEndPointHandler());
                                                       
onException(GenericFileOperationFailedException.class)
        .process(new DeliveryFailureHandler());
                                 
from("test-jms:queue:feed.notificationtest.queue")
        .process(processor)
        .recipientList(header("recipientListHeader").tokenize(","));


SendToEndPointHandler changes the body of the message received in the queue  and adds a custom header to identify the enpoint URI it is going to

I can see the new body in all endpoints I specify in recipientListHeader (FTP or SMTP)
in case one of the transmissions to an endpoint on recipientList runs in error in the DeliveryFailureHandler I see the original body (processed by 'processor') instead of the one modifed by SendToEndPointHandler
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
In reply to this post by Claus Ibsen-2
Claus Ibsen-2 wrote
Hi

See this unit test I just added for inspiration, showing how to do it
in 2.0 and in the future in 2.1 where you got the headers already for
free.
http://svn.apache.org/viewvc?rev=833011&view=rev

I think the issue is in the FTP component,
by using following context

context.addRoutes(new RouteBuilder() {

        public void configure() {

                onException(Exception.class)
                                .handled(true)
                                .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");

                interceptSendToEndpoint("(ftp|direct):.*").process(new Processor() {
                                public void process(Exchange exchange) throws Exception {
                                                String target = exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
                                                exchange.getIn().setHeader("target", target);
                                                System.out.println("target:" + target);
                                }
                });

                from("direct:start").recipientList(header("foo"));
                from("direct:kabom").throwException(new IllegalArgumentException("Damn"));

        }
});

context.start();

String foo = "direct:foo,direct:kabom,ftp://notexist@ftp.unknown.com?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);



the log shows me target=direct://kabom for the error raised on direct:kabom enpoint
it shows me target=direct://start for the error raised on the ftp endpoint.
that's the issue I am facing, I am not able to see target=ftp://... when catching the exception on the FTP endpoint, looks like the header is not propagated to the FTP component.
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
doing the same thing with Camel 2.1 I can see what I am expecting
so it is definetly something with FTP component...
seems it is not keeping headers that are set on interceptSendToEndpoint


mcrive wrote
I think the issue is in the FTP component,
by using following context

context.addRoutes(new RouteBuilder() {

        public void configure() {

                onException(Exception.class)
                                .handled(true)
                                .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");

                interceptSendToEndpoint("(ftp|direct):.*").process(new Processor() {
                                public void process(Exchange exchange) throws Exception {
                                                String target = exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
                                                exchange.getIn().setHeader("target", target);
                                                System.out.println("target:" + target);
                                }
                });

                from("direct:start").recipientList(header("foo"));
                from("direct:kabom").throwException(new IllegalArgumentException("Damn"));

        }
});

context.start();

String foo = "direct:foo,direct:kabom,ftp://notexist@ftp.unknown.com?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);



the log shows me target=direct://kabom for the error raised on direct:kabom enpoint
it shows me target=direct://start for the error raised on the ftp endpoint.
that's the issue I am facing, I am not able to see target=ftp://... when catching the exception on the FTP endpoint, looks like the header is not propagated to the FTP component.
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
On Thu, Nov 5, 2009 at 4:09 PM, mcrive <[hidden email]> wrote:
>
> doing the same thing with Camel 2.1 I can see what I am expecting
> so it is definetly something with FTP component...
> seems it is not keeping headers that are set on interceptSendToEndpoint
>
>

Hi

I just added a FTP unit test that uses recipient list and error
handling. And it works for me.
http://svn.apache.org/viewvc?rev=833105&view=rev


>
> mcrive wrote:
>>
>>
>> I think the issue is in the FTP component,
>> by using following context
>>
>> context.addRoutes(new RouteBuilder() {
>>
>>       public void configure() {
>>
>>               onException(Exception.class)
>>                               .handled(true)
>>
>> .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");
>>
>>               interceptSendToEndpoint("(ftp|direct):.*").process(new Processor() {
>>                               public void process(Exchange exchange) throws Exception {
>>                                               String target =
>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
>>                                               exchange.getIn().setHeader("target", target);
>>                                               System.out.println("target:" + target);
>>                               }
>>               });
>>
>>               from("direct:start").recipientList(header("foo"));
>>               from("direct:kabom").throwException(new
>> IllegalArgumentException("Damn"));
>>
>>       }
>> });
>>
>> context.start();
>>
>> String foo =
>> "direct:foo,direct:kabom,ftp://[hidden email]?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
>> template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);
>>
>>
>> the log shows me target=direct://kabom for the error raised on
>> direct:kabom enpoint
>> it shows me target=direct://start for the error raised on the ftp
>> endpoint.
>> that's the issue I am facing, I am not able to see target=ftp://... when
>> catching the exception on the FTP endpoint, looks like the header is not
>> propagated to the FTP component.
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26215744.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
Isn't the trunk where you commit the one containing changes after 2.0 REL?
I am facing the issue with 2.0, everything is fine with 2.1.




Claus Ibsen-2 wrote
On Thu, Nov 5, 2009 at 4:09 PM, mcrive <mcrive@optasportsdata.com> wrote:
>
> doing the same thing with Camel 2.1 I can see what I am expecting
> so it is definetly something with FTP component...
> seems it is not keeping headers that are set on interceptSendToEndpoint
>
>

Hi

I just added a FTP unit test that uses recipient list and error
handling. And it works for me.
http://svn.apache.org/viewvc?rev=833105&view=rev


>
> mcrive wrote:
>>
>>
>> I think the issue is in the FTP component,
>> by using following context
>>
>> context.addRoutes(new RouteBuilder() {
>>
>>       public void configure() {
>>
>>               onException(Exception.class)
>>                               .handled(true)
>>
>> .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");
>>
>>               interceptSendToEndpoint("(ftp|direct):.*").process(new Processor() {
>>                               public void process(Exchange exchange) throws Exception {
>>                                               String target =
>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
>>                                               exchange.getIn().setHeader("target", target);
>>                                               System.out.println("target:" + target);
>>                               }
>>               });
>>
>>               from("direct:start").recipientList(header("foo"));
>>               from("direct:kabom").throwException(new
>> IllegalArgumentException("Damn"));
>>
>>       }
>> });
>>
>> context.start();
>>
>> String foo =
>> "direct:foo,direct:kabom,ftp://notexist@ftp.unknown.com?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
>> template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);
>>
>>
>> the log shows me target=direct://kabom for the error raised on
>> direct:kabom enpoint
>> it shows me target=direct://start for the error raised on the ftp
>> endpoint.
>> that's the issue I am facing, I am not able to see target=ftp://... when
>> catching the exception on the FTP endpoint, looks like the header is not
>> propagated to the FTP component.
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26215744.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
On Fri, Nov 6, 2009 at 10:02 AM, mcrive <[hidden email]> wrote:
>
> Isn't the trunk where you commit the one containing changes after 2.0 REL?
> I am facing the issue with 2.0, everything is fine with 2.1.
>

Yeah it was against trunk.

Instead of using intercept to endpoint you could use your own kind of
recipient list using a regular processor where you set the header
before sending to that endpoint.

So instead of .recipientList(xxx) you can use a .process(new
MyRecipientListProcessor(xxx));


>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Nov 5, 2009 at 4:09 PM, mcrive <[hidden email]> wrote:
>>>
>>> doing the same thing with Camel 2.1 I can see what I am expecting
>>> so it is definetly something with FTP component...
>>> seems it is not keeping headers that are set on interceptSendToEndpoint
>>>
>>>
>>
>> Hi
>>
>> I just added a FTP unit test that uses recipient list and error
>> handling. And it works for me.
>> http://svn.apache.org/viewvc?rev=833105&view=rev
>>
>>
>>>
>>> mcrive wrote:
>>>>
>>>>
>>>> I think the issue is in the FTP component,
>>>> by using following context
>>>>
>>>> context.addRoutes(new RouteBuilder() {
>>>>
>>>>       public void configure() {
>>>>
>>>>               onException(Exception.class)
>>>>                               .handled(true)
>>>>
>>>> .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");
>>>>
>>>>               interceptSendToEndpoint("(ftp|direct):.*").process(new
>>>> Processor() {
>>>>                               public void process(Exchange exchange)
>>>> throws Exception {
>>>>                                               String target =
>>>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
>>>>
>>>> exchange.getIn().setHeader("target", target);
>>>>
>>>> System.out.println("target:" + target);
>>>>                               }
>>>>               });
>>>>
>>>>               from("direct:start").recipientList(header("foo"));
>>>>               from("direct:kabom").throwException(new
>>>> IllegalArgumentException("Damn"));
>>>>
>>>>       }
>>>> });
>>>>
>>>> context.start();
>>>>
>>>> String foo =
>>>> "direct:foo,direct:kabom,ftp://[hidden email]?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
>>>> template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);
>>>>
>>>>
>>>> the log shows me target=direct://kabom for the error raised on
>>>> direct:kabom enpoint
>>>> it shows me target=direct://start for the error raised on the ftp
>>>> endpoint.
>>>> that's the issue I am facing, I am not able to see target=ftp://... when
>>>> catching the exception on the FTP endpoint, looks like the header is not
>>>> propagated to the FTP component.
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26215744.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26228650.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
Is this FTP component issue a bug? Do you think there is a chance to have a fix in Camel 2.0?
thank you very much for the support!
Claus Ibsen-2 wrote
On Fri, Nov 6, 2009 at 10:02 AM, mcrive <mcrive@optasportsdata.com> wrote:
>
> Isn't the trunk where you commit the one containing changes after 2.0 REL?
> I am facing the issue with 2.0, everything is fine with 2.1.
>

Yeah it was against trunk.

Instead of using intercept to endpoint you could use your own kind of
recipient list using a regular processor where you set the header
before sending to that endpoint.

So instead of .recipientList(xxx) you can use a .process(new
MyRecipientListProcessor(xxx));


>
>
>
>
> Claus Ibsen-2 wrote:
>>
>> On Thu, Nov 5, 2009 at 4:09 PM, mcrive <mcrive@optasportsdata.com> wrote:
>>>
>>> doing the same thing with Camel 2.1 I can see what I am expecting
>>> so it is definetly something with FTP component...
>>> seems it is not keeping headers that are set on interceptSendToEndpoint
>>>
>>>
>>
>> Hi
>>
>> I just added a FTP unit test that uses recipient list and error
>> handling. And it works for me.
>> http://svn.apache.org/viewvc?rev=833105&view=rev
>>
>>
>>>
>>> mcrive wrote:
>>>>
>>>>
>>>> I think the issue is in the FTP component,
>>>> by using following context
>>>>
>>>> context.addRoutes(new RouteBuilder() {
>>>>
>>>>       public void configure() {
>>>>
>>>>               onException(Exception.class)
>>>>                               .handled(true)
>>>>
>>>> .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");
>>>>
>>>>               interceptSendToEndpoint("(ftp|direct):.*").process(new
>>>> Processor() {
>>>>                               public void process(Exchange exchange)
>>>> throws Exception {
>>>>                                               String target =
>>>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT, String.class);
>>>>
>>>> exchange.getIn().setHeader("target", target);
>>>>
>>>> System.out.println("target:" + target);
>>>>                               }
>>>>               });
>>>>
>>>>               from("direct:start").recipientList(header("foo"));
>>>>               from("direct:kabom").throwException(new
>>>> IllegalArgumentException("Damn"));
>>>>
>>>>       }
>>>> });
>>>>
>>>> context.start();
>>>>
>>>> String foo =
>>>> "direct:foo,direct:kabom,ftp://notexist@ftp.unknown.com?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
>>>> template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);
>>>>
>>>>
>>>> the log shows me target=direct://kabom for the error raised on
>>>> direct:kabom enpoint
>>>> it shows me target=direct://start for the error raised on the ftp
>>>> endpoint.
>>>> that's the issue I am facing, I am not able to see target=ftp://... when
>>>> catching the exception on the FTP endpoint, looks like the header is not
>>>> propagated to the FTP component.
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26215744.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26228650.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
On Fri, Nov 6, 2009 at 1:00 PM, mcrive <[hidden email]> wrote:
>
> Is this FTP component issue a bug? Do you think there is a chance to have a
> fix in Camel 2.0?
> thank you very much for the support!
>

No we wont do a special 2.0 patched release. The next one is 2.1 which
hopefully should get started soon when Hadrian returns from ApacheCon
US.

There are other solutions to this in pure 2.0 that you have to use instead.

You could add a header to the message that contains all the endpoints
in the receipient list then you at least have them all.
And then you can maybe compute which one failed in your custom error
handler processor.



> Claus Ibsen-2 wrote:
>>
>> On Fri, Nov 6, 2009 at 10:02 AM, mcrive <[hidden email]> wrote:
>>>
>>> Isn't the trunk where you commit the one containing changes after 2.0
>>> REL?
>>> I am facing the issue with 2.0, everything is fine with 2.1.
>>>
>>
>> Yeah it was against trunk.
>>
>> Instead of using intercept to endpoint you could use your own kind of
>> recipient list using a regular processor where you set the header
>> before sending to that endpoint.
>>
>> So instead of .recipientList(xxx) you can use a .process(new
>> MyRecipientListProcessor(xxx));
>>
>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Thu, Nov 5, 2009 at 4:09 PM, mcrive <[hidden email]>
>>>> wrote:
>>>>>
>>>>> doing the same thing with Camel 2.1 I can see what I am expecting
>>>>> so it is definetly something with FTP component...
>>>>> seems it is not keeping headers that are set on interceptSendToEndpoint
>>>>>
>>>>>
>>>>
>>>> Hi
>>>>
>>>> I just added a FTP unit test that uses recipient list and error
>>>> handling. And it works for me.
>>>> http://svn.apache.org/viewvc?rev=833105&view=rev
>>>>
>>>>
>>>>>
>>>>> mcrive wrote:
>>>>>>
>>>>>>
>>>>>> I think the issue is in the FTP component,
>>>>>> by using following context
>>>>>>
>>>>>> context.addRoutes(new RouteBuilder() {
>>>>>>
>>>>>>       public void configure() {
>>>>>>
>>>>>>               onException(Exception.class)
>>>>>>                               .handled(true)
>>>>>>
>>>>>> .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");
>>>>>>
>>>>>>               interceptSendToEndpoint("(ftp|direct):.*").process(new
>>>>>> Processor() {
>>>>>>                               public void process(Exchange exchange)
>>>>>> throws Exception {
>>>>>>                                               String target =
>>>>>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT,
>>>>>> String.class);
>>>>>>
>>>>>> exchange.getIn().setHeader("target", target);
>>>>>>
>>>>>> System.out.println("target:" + target);
>>>>>>                               }
>>>>>>               });
>>>>>>
>>>>>>               from("direct:start").recipientList(header("foo"));
>>>>>>               from("direct:kabom").throwException(new
>>>>>> IllegalArgumentException("Damn"));
>>>>>>
>>>>>>       }
>>>>>> });
>>>>>>
>>>>>> context.start();
>>>>>>
>>>>>> String foo =
>>>>>> "direct:foo,direct:kabom,ftp://[hidden email]?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
>>>>>> template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);
>>>>>>
>>>>>>
>>>>>> the log shows me target=direct://kabom for the error raised on
>>>>>> direct:kabom enpoint
>>>>>> it shows me target=direct://start for the error raised on the ftp
>>>>>> endpoint.
>>>>>> that's the issue I am facing, I am not able to see target=ftp://...
>>>>>> when
>>>>>> catching the exception on the FTP endpoint, looks like the header is
>>>>>> not
>>>>>> propagated to the FTP component.
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26215744.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26228650.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26230486.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Claus Ibsen-2
In reply to this post by Marco Crivellaro
On Fri, Nov 6, 2009 at 1:00 PM, mcrive <[hidden email]> wrote:
>
> Is this FTP component issue a bug? Do you think there is a chance to have a
> fix in Camel 2.0?
> thank you very much for the support!
>

And if you are looking for such kind of support you very likely have
to acquired paid support. Which offers such kind of custom specific
patches.




> Claus Ibsen-2 wrote:
>>
>> On Fri, Nov 6, 2009 at 10:02 AM, mcrive <[hidden email]> wrote:
>>>
>>> Isn't the trunk where you commit the one containing changes after 2.0
>>> REL?
>>> I am facing the issue with 2.0, everything is fine with 2.1.
>>>
>>
>> Yeah it was against trunk.
>>
>> Instead of using intercept to endpoint you could use your own kind of
>> recipient list using a regular processor where you set the header
>> before sending to that endpoint.
>>
>> So instead of .recipientList(xxx) you can use a .process(new
>> MyRecipientListProcessor(xxx));
>>
>>
>>>
>>>
>>>
>>>
>>> Claus Ibsen-2 wrote:
>>>>
>>>> On Thu, Nov 5, 2009 at 4:09 PM, mcrive <[hidden email]>
>>>> wrote:
>>>>>
>>>>> doing the same thing with Camel 2.1 I can see what I am expecting
>>>>> so it is definetly something with FTP component...
>>>>> seems it is not keeping headers that are set on interceptSendToEndpoint
>>>>>
>>>>>
>>>>
>>>> Hi
>>>>
>>>> I just added a FTP unit test that uses recipient list and error
>>>> handling. And it works for me.
>>>> http://svn.apache.org/viewvc?rev=833105&view=rev
>>>>
>>>>
>>>>>
>>>>> mcrive wrote:
>>>>>>
>>>>>>
>>>>>> I think the issue is in the FTP component,
>>>>>> by using following context
>>>>>>
>>>>>> context.addRoutes(new RouteBuilder() {
>>>>>>
>>>>>>       public void configure() {
>>>>>>
>>>>>>               onException(Exception.class)
>>>>>>                               .handled(true)
>>>>>>
>>>>>> .to("log:org.apache.camel.example?showHeaders=true&showCaughtException=true");
>>>>>>
>>>>>>               interceptSendToEndpoint("(ftp|direct):.*").process(new
>>>>>> Processor() {
>>>>>>                               public void process(Exchange exchange)
>>>>>> throws Exception {
>>>>>>                                               String target =
>>>>>> exchange.getIn().getHeader(Exchange.INTERCEPTED_ENDPOINT,
>>>>>> String.class);
>>>>>>
>>>>>> exchange.getIn().setHeader("target", target);
>>>>>>
>>>>>> System.out.println("target:" + target);
>>>>>>                               }
>>>>>>               });
>>>>>>
>>>>>>               from("direct:start").recipientList(header("foo"));
>>>>>>               from("direct:kabom").throwException(new
>>>>>> IllegalArgumentException("Damn"));
>>>>>>
>>>>>>       }
>>>>>> });
>>>>>>
>>>>>> context.start();
>>>>>>
>>>>>> String foo =
>>>>>> "direct:foo,direct:kabom,ftp://[hidden email]?password=what&tempPrefix=tmp&fileName=cif-prototype/feed.xml";
>>>>>> template.sendBodyAndHeader("direct:start", "Hello World", "foo", foo);
>>>>>>
>>>>>>
>>>>>> the log shows me target=direct://kabom for the error raised on
>>>>>> direct:kabom enpoint
>>>>>> it shows me target=direct://start for the error raised on the ftp
>>>>>> endpoint.
>>>>>> that's the issue I am facing, I am not able to see target=ftp://...
>>>>>> when
>>>>>> catching the exception on the FTP endpoint, looks like the header is
>>>>>> not
>>>>>> propagated to the FTP component.
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26215744.html
>>>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Claus Ibsen
>>>> Apache Camel Committer
>>>>
>>>> Author of Camel in Action: http://www.manning.com/ibsen/
>>>> Open Source Integration: http://fusesource.com
>>>> Blog: http://davsclaus.blogspot.com/
>>>> Twitter: http://twitter.com/davsclaus
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26228650.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> Claus Ibsen
>> Apache Camel Committer
>>
>> Author of Camel in Action: http://www.manning.com/ibsen/
>> Open Source Integration: http://fusesource.com
>> Blog: http://davsclaus.blogspot.com/
>> Twitter: http://twitter.com/davsclaus
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Error-handling-with-recipientList-tp26196454p26230486.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
>



--
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Reply | Threaded
Open this post in threaded view
|

Re: Error handling with recipientList

Marco Crivellaro
Ok, many thanks for the precious help

Claus Ibsen-2 wrote
And if you are looking for such kind of support you very likely have
to acquired paid support. Which offers such kind of custom specific
patches.