Hi

Yeah the sample is identical. But when the exchange fails, and onException is 
taking over, then it's the *original* exchange (= copy, aka snapshot) that is 
used, just before the node that fails.

So its kinda like this

                from(fromRoute)
TAKE SNAPSHOT (A)
                .beanRef("listTransformer", " fromStringToFundList initId") 
TAKE SNAPSHOT (B)
            .to("bean:fundListDao?methodName=save");                    

So when the beanRef fails and onException is kicked in, then the exchange that 
is used there is from SNAPSHOT A. It need to do a SNAPSHOT when it does retries.





Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk

-----Original Message-----
From: borgel [mailto:[EMAIL PROTECTED] 
Sent: 14. oktober 2008 13:07
To: [email protected]
Subject: RE: Error Handler and OutHeaders


What if I want to add other values to the header that i cannot initialize?
I have looked at the example "Example using handled" here:
http://activemq.apache.org/camel/exception-clause.html
and I don't see the difference. In the example a customerid is added to the
header without initializing it first.


Claus Ibsen wrote:
> 
> Hi
> 
> Id is null because the exchange that is caught by onException is a
> snapshot of the exchange just before your bean listTransformer is invoked. 
> 
> Any changes to the exchange that happens in listTransformer is not
> effective/visible for the error handler.
> 
> You can use 2 bean calls to let the id be visible
>               from(fromRoute)
>               .beanRef("listTransformer", "initId")
>               .beanRef("listTransformer", "fromStringToFundList")     
> .to("bean:fundListDao?methodName=save");                      
> 
> For instance a initId() method that is simple and just set the id.
> 
> Then if there is a failure in the 2nd bean then the snapshot is from just
> before the 2nd bean call.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Error-Handler-and-OutHeaders-tp19970966s22882p19971372.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to