On Wed, May 13, 2009 at 5:09 PM, turp1twin <jeff.tur...@ecloser.net> wrote: > > Thanks for the reply Claus! Your help is very much appreciated. Perhaps I > will extend the camel code to allow for redelivery functionality using > try/catch semantics. Cheers! Contributions is always welcome.
For starters you could create a JIRA ticket for it so we wont forget. And maybe I can have a 2nd look to see what it takes to add it. > > > Jeff > > > Claus Ibsen-2 wrote: >> >> On Wed, May 13, 2009 at 2:59 PM, Claus Ibsen <claus.ib...@gmail.com> >> wrote: >>> On Tue, May 12, 2009 at 10:34 PM, turp1twin <jeff.tur...@ecloser.net> >>> wrote: >>>> >>>> Hi Claus, >>>> >>>> One last question... Is it possible to define retry/redelivery semantics >>>> when using try/catch DSL functionality? >>> Good question. As doCatch is basically also a OnException model it >>> should be in the DSL. But I have to check in the code as the try .. >>> catch .. finally is a bit special over regular routing. >>> >>> But I have been super busy with the new onCompletion DSL feature in >>> Camel 2.0 and Customer support. >>> So remind me later if I have not replied. >> I had a quick look. >> >> You cannot do that. >> >>> >>>> >>>> >>>> Jeff >>>> >>>> >>>> Claus Ibsen-2 wrote: >>>>> >>>>> On Tue, May 12, 2009 at 6:31 AM, turp1twin <jeff.tur...@ecloser.net> >>>>> wrote: >>>>>> >>>>>> Hi Claus, >>>>>> >>>>>> Thanks so much for the quick response! This helps me very much! Yes, >>>>>> basically, if the sending the email fails, I just want to log the >>>>>> error >>>>>> and >>>>>> end the route. I want the File consumer to complete and move/delete >>>>>> the >>>>>> file, since a new file will be created and processed at a later time >>>>>> with >>>>>> the same data since the FTP failed. Anyways, the info you provided >>>>>> below >>>>>> will be very helpful. I have created a Processor to handle the errors >>>>>> this >>>>>> evening, and that seems to work, however, I think the try catch >>>>>> semantics >>>>>> of >>>>>> the Java DSL will be cleaner. Should I pull down the 2.0-M2 snapshot? >>>>> 2.0m2 has not been released yet. >>>>> >>>>> You can try the SNAPSHOT instead as its released every day :) >>>>> http://camel.apache.org/download.html >>>>> >>>>> 2.0m2 is however scheduled to be released any time soon. Just the >>>>> person doing the release is very busy and Camel 1.6.1 has higher prio >>>>> to be released first. >>>>> >>>>> >>>>>> Cheers! >>>>>> >>>>>> >>>>>> Jeff >>>>>> >>>>>> >>>>>> Claus Ibsen-2 wrote: >>>>>>> >>>>>>> Hi >>>>>>> >>>>>>> Error handling is hard, especially for non transactional transports >>>>>>> such as File / FTP and the likes. >>>>>>> >>>>>>> From what I understand from your description is that you want to poll >>>>>>> files and upload them to SFTP. >>>>>>> And in case this fails an email should be sent. And if this email >>>>>>> fails then it should ???? >>>>>>> >>>>>>> If you where doing this with regular Java you would probably use the >>>>>>> try .. catch .. finally. >>>>>>> And they also exists in Camel DSL >>>>>>> >>>>>>> .doTry() >>>>>>> // send file to SFTP >>>>>>> .doCatch(Exception) >>>>>>> .doTry() >>>>>>> // send an email >>>>>>> .doCatch() >>>>>>> // log failed to send email >>>>>>> .end() >>>>>>> .end() >>>>>>> >>>>>>> And they support handled(true) as well. >>>>>>> See more here >>>>>>> http://davsclaus.blogspot.com/2009/04/on-road-to-camel-20-try-catch-finally.html >>>>>>> >>>>>>> And here: >>>>>>> http://camel.apache.org/try-catch-finally.html >>>>>>> >>>>>>> However try .. catch .. finally have been overhauled in Camel 2.0m2 >>>>>>> so >>>>>>> you have to wait for this release or use SNAPSHOT if you want. >>>>>>> >>>>>>> >>>>>>> Also the general error handling in Camel 2.0 have had a major >>>>>>> overhaul >>>>>>> as well. In fact I do believe that the problem with error handling, >>>>>>> when doing error handling has been fixed in 2.0m2 (SNAPSHOT) as well. >>>>>>> >>>>>>> So in your case if the SMTP failed then it would not "catch this" but >>>>>>> it should be fixed in 2.0m2. >>>>>>> >>>>>>> >>>>>>> >>>>>>> If you want to avoid consuming the same file again then use the >>>>>>> Idempotent Consumer EIP >>>>>>> http://camel.apache.org/idempotent-consumer.html >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Tue, May 12, 2009 at 1:30 AM, turp1twin <jeff.tur...@ecloser.net> >>>>>>> wrote: >>>>>>>> >>>>>>>> I am new to Camel and am having a tough time getting my route to >>>>>>>> work >>>>>>>> properly. That being said, it is entirely possible that I am being a >>>>>>>> moron >>>>>>>> and have missed something simple.... However, I have searched the >>>>>>>> mailing >>>>>>>> list and have not found the answer I am looking for. Any help would >>>>>>>> be >>>>>>>> appreciated. I am using Camel 2.0-M1 and I am trying to test my >>>>>>>> various >>>>>>>> error handling scenarios. I am using a Java DSL with various >>>>>>>> endpoints >>>>>>>> configured in my Spring camel-context.xml. >>>>>>>> >>>>>>>> Endpoints: >>>>>>>> >>>>>>>> <camel:endpoint id="filePollingDir" >>>>>>>> uri="file:///Users/xxxxx/temp/polldir/"/> >>>>>>>> >>>>>>>> <camel:endpoint id="sFtpDestination" >>>>>>>> >>>>>>>> uri="sftp://r098...@sftp.someserver.com/upload?password=xxxxxx&knownHostsFile=/Users/xxxxx/.ssh/known_hosts"/> >>>>>>>> >>>>>>>> <camel:endpoint id="failedTransferSmtp" >>>>>>>> uri="smtp://smtp.someserver.net?to=u...@mymail.net&from=ad...@mymail.net"/> >>>>>>>> >>>>>>>> Route definition: >>>>>>>> >>>>>>>> from(getEndpoint("filePollingDir")).onException(Exception.class).maximumRedeliveries(0).handled(true).end() >>>>>>>> .to(getEndpoint("sFtpDestination")).onException(Exception.class).maximumRedeliveries(2).handled(true) >>>>>>>> .to(getEndpoint("failedTransferSmtp")).onException(Exception.class).maximumRedeliveries(0).handled(true).end(); >>>>>>>> >>>>>>>> >>>>>>>> Basically what I am trying to achieve is that if the SFTP producer >>>>>>>> fails >>>>>>>> I >>>>>>>> want to send an email notifying a user that the transfer failed. I >>>>>>>> also >>>>>>>> want >>>>>>>> to handle the case where the smtp producer might also fail. I am >>>>>>>> getting >>>>>>>> to >>>>>>>> the SMTP endpoint (failedTransferSmtp) just fine, however, when it >>>>>>>> fails >>>>>>>> (as >>>>>>>> intended for this particular test) it causes the "filePollingDir" >>>>>>>> consumer >>>>>>>> to rollback and consume the source file again. This continues in a >>>>>>>> loop... >>>>>>>> Is this behavior intended? If so, can I configure the consumer to >>>>>>>> stop >>>>>>>> consuming the same file again? Again, I might be missing something >>>>>>>> simple, >>>>>>>> but any help would be appreciated. Cheers! >>>>>>>> >>>>>>>> Jeff >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> -- >>>>>>>> View this message in context: >>>>>>>> http://www.nabble.com/Error-Handling-tp23493625p23493625.html >>>>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> -- >>>>>>> Claus Ibsen >>>>>>> Apache Camel Committer >>>>>>> >>>>>>> Open Source Integration: http://fusesource.com >>>>>>> Blog: http://davsclaus.blogspot.com/ >>>>>>> Twitter: http://twitter.com/davsclaus >>>>>>> Apache Camel Reference Card: >>>>>>> http://refcardz.dzone.com/refcardz/enterprise-integration >>>>>>> Interview with me: >>>>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>>> View this message in context: >>>>>> http://www.nabble.com/Error-Handling-tp23493625p23496008.html >>>>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Claus Ibsen >>>>> Apache Camel Committer >>>>> >>>>> Open Source Integration: http://fusesource.com >>>>> Blog: http://davsclaus.blogspot.com/ >>>>> Twitter: http://twitter.com/davsclaus >>>>> Apache Camel Reference Card: >>>>> http://refcardz.dzone.com/refcardz/enterprise-integration >>>>> Interview with me: >>>>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/Error-Handling-tp23493625p23509898.html >>>> Sent from the Camel - Users mailing list archive at Nabble.com. >>>> >>>> >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> Apache Camel Reference Card: >>> http://refcardz.dzone.com/refcardz/enterprise-integration >>> Interview with me: >>> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> Apache Camel Reference Card: >> http://refcardz.dzone.com/refcardz/enterprise-integration >> Interview with me: >> http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress >> >> > > -- > View this message in context: > http://www.nabble.com/Error-Handling-tp23493625p23523791.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus Apache Camel Reference Card: http://refcardz.dzone.com/refcardz/enterprise-integration Interview with me: http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress