I don't believe the AggregatorStrategy is the problem, but here is mine:

public class DispensingAggregationStrategy implements AggregationStrategy{

    
        public Exchange aggregate(Exchange oldExchange, Exchange newExchange)  
{        
        
        if (oldExchange == null)
                return newExchange;
        
        NewDispensingBean body =
newExchange.getIn().getBody(NewDispensingBean.class);
        NewDispensingBean existing =
oldExchange.getIn().getBody(NewDispensingBean.class);           
        existing.aggregate(body);
        
        Object rde = newExchange.getIn().getHeader("rde");
        
        if(rde != null)
                oldExchange.getIn().setHeader("rde", rde);
        
        oldExchange.getIn().setBody(existing);
        return oldExchange;
        }       
        
}

This just agregates the splitter results into a NewDispensingBean. As I
mentioned earlier, I tried to capture the error using the following in the
Aggregator, but newExchange.getException() was always null:

if (newExchange.getException() != null) {
    if (oldExchange == null) {
         return newExchange;
    } else {
         oldExchange.setException(
         newExchange.getException());
         return oldExchange;
    }
}

--
View this message in context: 
http://camel.465427.n5.nabble.com/Splitter-StopOnException-doesn-t-forward-the-exception-on-the-Exchange-tp4469882p4476414.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to