I have set up a route with an error handler like this:
@Override
        public void configure() throws Exception
        {                       
                onException(TransformException.class)
                .handled(true)
                .beanRef("listTransformer", "transformFailed")
                .to("bean:errorDao");
                from(fromRoute)
                .beanRef("listTransformer", "fromStringToFundList")
                .to("bean:fundListDao?methodName=save");                        
        }

in the listTransformer I add an id value to the map:
public List<Fund> fromStringToFundList(@Headers Map in,
@org.apache.camel.Body String payload, @OutHeaders Map out)
{
Header  header = getHeader(payload);
id = header.getId();
out.put("headerId", id);
logger.info("Id in transformer: " + id);
List<Fund> funds = getFunds(payload)

return funds
}

When an error occurs in getFunds the errorHandler kicks in and calls
transformFailed:
public Object transformFailed(@Headers Map in, @org.apache.camel.Body String
payload, @OutHeaders Map out)
{
        logger.info("Id in transformFailed: " + in.get("headerId"));
        return "ERROR";
}

This will produce the following output:
Id in transformer: 586
Id in transformFailed: null

Why is id in transformFailed null?
-- 
View this message in context: 
http://www.nabble.com/Error-Handler-and-OutHeaders-tp19970966s22882p19970966.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to