Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 96168 invoked from network); 13 May 2009 14:07:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 May 2009 14:07:32 -0000 Received: (qmail 82268 invoked by uid 500); 13 May 2009 14:07:30 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 82237 invoked by uid 500); 13 May 2009 14:07:30 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 82217 invoked by uid 99); 13 May 2009 14:07:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2009 14:07:25 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.226 as permitted sender) Received: from [209.85.218.226] (HELO mail-bw0-f226.google.com) (209.85.218.226) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 May 2009 14:07:13 +0000 Received: by bwz26 with SMTP id 26so666321bwz.20 for ; Wed, 13 May 2009 07:06:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=I/ZLLWSFnRHbRLHVsq9JSgK/JTDBmPwDjBK9gm3D4so=; b=C2NLSXqVA0/EYQiQqNxOiz7D/ruSBYxj+7P3CLjDk2EXZs71o6NXOWnliK2D1G3ydm B6iVEHVvKOUFCh5rBfDNV//tAd8uLMjrOueMg3b1tXLZYG2ORNa30ndtVXqwxiK3xSEy drsCziiSDqS79KhcUG+5PxaoovNbccPGy24mI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=Co15n5xnnEZAlh3W1P/iMm04tTVK7Koh8zLITVWHEszcNAZ9d/0GPzU1xYw5Qi/T3E 4TCPcbo1+azSLqKo+PoMs94S9AJfAqUciov2OdAJufGp2nOw8Q15bhI6wVE+t9oWVki0 TF3O9O8+xbv8LoI38Lxna6/ltVW5PD2heYLRA= MIME-Version: 1.0 Received: by 10.223.121.6 with SMTP id f6mr869709far.77.1242223612253; Wed, 13 May 2009 07:06:52 -0700 (PDT) In-Reply-To: <5380c69c0905130559w5bd4d2ffm3019ca11bed2cea6@mail.gmail.com> References: <23493625.post@talk.nabble.com> <5380c69c0905112120o32a955d5n5e97affdfa7b024b@mail.gmail.com> <23496008.post@talk.nabble.com> <5380c69c0905120131t7ce1ced9gdcc28d877aed76ff@mail.gmail.com> <23509898.post@talk.nabble.com> <5380c69c0905130559w5bd4d2ffm3019ca11bed2cea6@mail.gmail.com> From: Claus Ibsen Date: Wed, 13 May 2009 16:06:32 +0200 Message-ID: <5380c69c0905130706vecd29a1raa4d58809fb63ad6@mail.gmail.com> Subject: Re: Error Handling To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, May 13, 2009 at 2:59 PM, Claus Ibsen wrote: > On Tue, May 12, 2009 at 10:34 PM, turp1twin wro= te: >> >> 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 >>> 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 erro= r >>>> and >>>> end the route. I want the File consumer to complete and move/delete th= e >>>> file, since a new file will be created and processed at a later time w= ith >>>> the same data since the FTP failed. Anyways, the info you provided bel= ow >>>> 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 semant= ics >>>> 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() >>>>> =A0 =A0// send file to SFTP >>>>> .doCatch(Exception) >>>>> =A0 =A0.doTry() >>>>> =A0 =A0// send an email >>>>> =A0 =A0.doCatch() >>>>> =A0 =A0// log failed to send email >>>>> =A0 =A0.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-f= inally.html >>>>> >>>>> And here: >>>>> http://camel.apache.org/try-catch-finally.html >>>>> >>>>> However try .. catch .. finally have been overhauled in Camel 2.0m2 s= o >>>>> 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 overhau= l >>>>> 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 >>>>> wrote: >>>>>> >>>>>> I am new to Camel and am having a tough time getting my route to wor= k >>>>>> 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 vari= ous >>>>>> error handling scenarios. I am using a Java DSL with various endpoin= ts >>>>>> configured in my Spring camel-context.xml. >>>>>> >>>>>> Endpoints: >>>>>> >>>>>> >>>>> uri=3D"file:///Users/xxxxx/temp/polldir/"/> >>>>>> >>>>>> >>>>> >>>>>> uri=3D"sftp://R098697@sftp.someserver.com/upload?password=3Dxxxxxx&a= mp;knownHostsFile=3D/Users/xxxxx/.ssh/known_hosts"/> >>>>>> >>>>>> >>>>> uri=3D"smtp://smtp.someserver.net?to=3Duser@mymail.net&from=3Dad= min@mymail.net"/> >>>>>> >>>>>> Route definition: >>>>>> >>>>>> from(getEndpoint("filePollingDir")).onException(Exception.class).max= imumRedeliveries(0).handled(true).end() >>>>>> .to(getEndpoint("sFtpDestination")).onException(Exception.class).max= imumRedeliveries(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 a= lso >>>>>> 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 st= op >>>>>> 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= =3D7893-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=3D7= 893-progress >>> >>> >> >> -- >> View this message in context: http://www.nabble.com/Error-Handling-tp234= 93625p23509898.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=3D789= 3-progress > --=20 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=3D7893-= progress