Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 957177B03 for ; Thu, 11 Aug 2011 14:58:16 +0000 (UTC) Received: (qmail 43489 invoked by uid 500); 11 Aug 2011 14:58:16 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 43435 invoked by uid 500); 11 Aug 2011 14:58:15 -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 43427 invoked by uid 99); 11 Aug 2011 14:58:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2011 14:58:15 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.160.173 as permitted sender) Received: from [209.85.160.173] (HELO mail-gy0-f173.google.com) (209.85.160.173) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Aug 2011 14:58:09 +0000 Received: by gyd12 with SMTP id 12so1591589gyd.32 for ; Thu, 11 Aug 2011 07:57:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=ZjN51Ru7Ud3rUjEkfZ//O1eo8OiKUAf0aiI6LKfDxgY=; b=hQBG8fRr8DlJOPu6wpA8nEg3PBrTMVw1/urSjkzcXQVJxsqhNgfTP6ttgoF+F/WhpE qOwATUqYwh4XmIsLHzWCKIfmkLGBKdaWJzT2uYfPioRE/pMwQoE+fJG1W4yiwNWYt8v9 VhQHhkoQuSWeOzQh3frk617C0SidR/AVk4iH8= Received: by 10.101.168.5 with SMTP id v5mr8587899ano.14.1313074668172; Thu, 11 Aug 2011 07:57:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.100.34.5 with HTTP; Thu, 11 Aug 2011 07:57:28 -0700 (PDT) In-Reply-To: <1313048435379-4688705.post@n5.nabble.com> References: <1312892175662-4681829.post@n5.nabble.com> <1313048435379-4688705.post@n5.nabble.com> From: Claus Ibsen Date: Thu, 11 Aug 2011 16:57:28 +0200 Message-ID: Subject: Re: camel 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 Hi In the bean that handles the error handling, I think that is CSVConverterBean in the method validationFailed. What you can do is to pass error information back to the CallRoute. (or vise versa if you want to). So instead of using the .class you use an instance of the bean CSVConverterBean myConverterBean =3D new ... myConverterBean.setCallRoute(this); onException(IllegalClassFormatException.class).handled(true).bean(myConvert= erBean, "validationFailed).end(); And then in the validationFailed method, you can access the CallRoute instance as you passed to it using the setter setCallRoute. Then you can call a method on CallRoute to pass in error details. On Thu, Aug 11, 2011 at 9:40 AM, aum.struts wrote: > While going through the Documents it has been wriiten that the exception = or > custom message will be show back to caller > > i am confused what exactly caller in this case. > Since my route is being executed by the camel itself so its camel who is > caller? > > For e.g > in my routebuilder class > > public class CallRoute { > public void callRoute() throws Exception{ > CamelContext context =3D new DefaultCamelContext(); > context.addRoutes(new RouteBuilder() { > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0public= void configure() { > > onException(IllegalClassFormatException.class).handled(true).bean(CSVConv= erterBean.class, > "validationFailed).end(); > > from("file:data/csv?fileName=3Dinput-customer2.csv").unmarshal().csv() > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 .bean(new > CSVConverterBean(),"processCSVInvoice").to("xslt:http://localhost:7777/st= ruts2/styles/XMLConverter.xsl").to("file:data/csvoutput?fileName=3Dtest11.x= ml"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 } > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0}); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0context.start(); > =A0 =A0 =A0 =A0 =A0 =A0Thread.sleep(10000); > > =A0 =A0 =A0 =A0 =A0 =A0context.stop(); > =A0 =A0 =A0 =A0} > } > and i am calling callRoute() method from my main method in another class. > so in case IllegalClassFormatException onException() method will be calle= d > and which in turn will pass the things to CSVConverterBean.class, > "validationFailed method. > > So i can i pass the status back to main method? > > -- > View this message in context: http://camel.465427.n5.nabble.com/camel-Err= or-Handling-tp4681829p4688705.html > Sent from the Camel - Users mailing list archive at Nabble.com. > --=20 Claus Ibsen ----------------- FuseSource Email: cibsen@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/