I have a custom aggregator strategy but for some reason the oldExchange is 
always  null.  Any ideas?


Here is my route.

    from("seda:Split")
      .routeId("Split")
      .aggregate(new MyAggregationStrategy())
        .constant(true)
        .completionFromBatchConsumer()
        .completionPredicate(header("CamelBatchComplete").isEqualTo(true))
      .to("file://./target/?fileName=aggregated.xml")


Here is my AggregationStrategy:

    @Override
    public Exchange aggregate(final Exchange oldExchange, final Exchange 
newExchange) {
        MyObjects c = new MyObjects();

        if (oldExchange != null) {
            C = oldExchange.getIn().getBody(MyObjects.class);
        }

        final Message newIn = newExchange.getIn();
        final MyObject myObject= newExchange.getIn().getBody(MyObject.class);

        c.addMyObject(myObject);
        newIn.setBody(c);

        return newExchange;
    }

Reply via email to