Hi, 

Aggration seems to lost the connection to original Message.

I have the following construct:

from(FILE_IN_URI)
      .split(new ZipSplitter()).shareUnitOfWork()
          .streaming()
          .choice()
               .when(simple("${in.header.CamelFileName} ends with 'xml'"))
                   .process(exchange -> {
                          System.out.println("debug exchange"); -> throw 
EXCEPTION 1
                    })
                   .to(EP_AGGREGATION)
               .endChoice()
              .otherwise()
                  .to(FILE_OUT_URI)
                   .process(exchange -> {
                          System.out.println("debug exchange");    -> throw 
EXCEPTION 2
                    })
                  .to(EP_AGGREGATION)
              .endChoice()
          .end()
       .end()
;

from(EP_AGGREGATION_)        
       .aggregate(header("foo"), new ThomasAggregationStrategy())
        .completionTimeout(10 * 1000)
        .completion(header("bar").isEqualTo(true))
        .process(exchange -> {
             System.out.println("debug exchange");
        })
        .throwException(IllegalArgumentException.class, "Thomas DEBUG") -> 
throw EXCEPTION 3
;

A route with splitter and an aggregation route. 
Before the last "to" at the end I add a process with println to set a 
breakpoint and debug the exchange. 

What happens is, when an exception is thrown in the splitter route, e.g. 
instead of the debug println. 
(EXCEPTION 1 and 2) the deadletter route works. 
But when an exception is thrown after aggregation the infos are gone. 
I noticed that the exchange at the end, before .to(EP_AGGREGATION) is different 
from the exchange the 
ThomasAggregationStrategy:: aggregate() sees. I see unitOfWork is gone. 

errorHandler(deadLetterChannel("direct:deadletter").useOriginalMessage());
    from("direct:deadletter")
        // save original message



Reply via email to