camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Steve.Hed...@barclayscapital.com>
Subject RE: Exception details
Date Tue, 28 Sep 2010 16:14:04 GMT
Claus

I am having difficulty with this as I am using the Spring XML config approach.  The errorHandler
is defined outside of the camelContext while the routes are defied inside the camel context.
 At the point at which the errorHandler is instantiated it cannot see the error route. 

So I have:

	<errorHandler id="errorHandler" type="DeadLetterChannel"
		deadLetterUri="direct:errorHandlerRoute" />

And 

	<camelContext id="camel" xmlns:stp="http://www.barcap.com/gcd/stpengine/1-0">
...

		<route id="errorHandlerRoute">
		
			<log message="RAISED EXCEPTION: ${exception}" loggingLevel="ERROR"/>
			<to ref="JMS_ERROR"/>
		</route>	

...
/>

I'm guessing that this would not be a problem using the Java DSL.  But I really don't want
to use that approach.  (From a commercial point of view, ease of writing code in no way outweighs
the advantages of having XML configs that can be read by support staff at 2am).

Your continuing help is much appreciated

 
Steven Hedges
IT - Credit Booking Derivs
 

-----Original Message-----
From: Claus Ibsen [mailto:claus.ibsen@gmail.com] 
Sent: 28 September 2010 16:35
To: users@camel.apache.org
Subject: Re: Exception details

On Tue, Sep 28, 2010 at 5:27 PM,  <Steve.Hedges@barclayscapital.com> wrote:
> You realise I am going to have to get my 50 c of help now :-)
>
> Is it possible to use a route as an error handler?  I would like to be able to log an
exception, raise an SMS and push the message onto a queue for later reprocessing.  We are
trying to keep all of our config in the Spring XML.  (Config file releases are much simpler
admin-wise than code releases).
>

Yeah use the DeadLetterChannel and set the endpoint to a direct:myRoute

And then define a route with from("direct:myRoute") and its just like any other route.


>
> Steven Hedges
> IT - Credit Booking Derivs
>
> -----Original Message-----
> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
> Sent: 28 September 2010 16:13
> To: users@camel.apache.org
> Subject: Re: Exception details
>
> On Tue, Sep 28, 2010 at 3:46 PM,  <Steve.Hedges@barclayscapital.com> wrote:
>> I've bought the book!
>>
>
> Ah great. Then Jonathan and I earned 50 cent today.
>
> I hope the book will help and inspire you with your current endeavor with Camel. Good
luck.
>
>>
>>
>> Steven Hedges
>> IT - Credit Booking Derivs
>>
>> 10 The South Colonnade
>> Canary Wharf,
>> London E14 4PU,
>> United Kingdom
>>
>> 02031344655
>> x44655
>>
>> -----Original Message-----
>> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
>> Sent: 28 September 2010 14:33
>> To: users@camel.apache.org
>> Subject: Re: Exception details
>>
>> On Tue, Sep 28, 2010 at 3:26 PM,  <Steve.Hedges@barclayscapital.com> wrote:
>>> I'll get the book...
>>>
>>> From the info on that page, is it correct to assume that it is impossible to
get at the exception info from the Spring XML config?  All I want to do is to log the actual
exception to a file.
>>>
>>
>> The simple language can access the caused exception using $exception 
>> See simple http://camel.apache.org/simple
>>
>> Something like this:
>>
>> onException(Exception.class).handled(true).transform(simple("Damn the 
>> problem is $exception.message and 
>> stacktrace\n$exception")).to("file:errors");
>>
>> But reading the entire chapter 5 about error handling will help you understand some
of the many features it provides.
>> The wiki pages is a bit of a mess here and there for error handling as its a hard
topic to document well.
>>
>>
>>>
>>>
>>> Steven Hedges
>>> IT - Credit Booking Derivs
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: Claus Ibsen [mailto:claus.ibsen@gmail.com]
>>> Sent: 28 September 2010 14:09
>>> To: users@camel.apache.org
>>> Subject: Re: Exception details
>>>
>>> On Tue, Sep 28, 2010 at 2:49 PM,  <Steve.Hedges@barclayscapital.com> wrote:
>>>> Hi
>>>>
>>>> This is probably very straightforward, but I've scoured the docs and can't
find an answer.
>>>>
>>>> Is it possible to get details of the actual exception that occurred 
>>>> in an error handler?  So far, I can see how to access the message 
>>>> that caused an error (using the $body variable) but not the 
>>>> exception itself
>>>>
>>>
>>> Yeah if you got the Camel in Action book, see section 5.4.4
>>>
>>> And you can find also some details about it here 
>>> http://camel.apache.org/exception-clause.html
>>>
>>> see section _Using a processor as failure handler_
>>>
>>>> Thanks in advance
>>>>
>>>>
>>>> Steven Hedges
>>>> IT - Credit Booking Derivs
>>>>
>>>> 10 The South Colonnade
>>>> Canary Wharf,
>>>> London E14 4PU,
>>>> United Kingdom
>>>>
>>>> 02031344655
>>>> x44655
>>>>
>>>>
>>>> _______________________________________________
>>>>
>>>> This e-mail may contain information that is confidential, privileged or otherwise
protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate
or redistribute it by any means. Please delete it and any attachments and notify the sender
that you have received it in error. Unless specifically indicated, this e-mail is not an offer
to buy or sell or a solicitation to buy or sell any securities, investment products or other
financial product or service, an official confirmation of any transaction, or an official
statement of Barclays. Any views or opinions presented are solely those of the author and
do not necessarily represent those of Barclays. This e-mail is subject to terms available
at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent
to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC,
a company registered in England (number 1026167) with its registered office at 1 Churchill
Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays
Group.
>>>> _______________________________________________
>>>>
>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>>
>>
>> --
>> 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
>>
>
>
>
> --
> 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
>



--
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

Mime
View raw message