aggregation failed
vasuk Sep 3, 2012 5:36 AMHi All
i have to aggregate two XML files which are converted from csv format successfuly ,available at different times.
I have to aggregate both xml file to single xml file.
But I am facing the problem in aggregation
here i am providing my code and error details ,
ROUTING
public void configure() {
try {
DataFormat bindy = new BindyCsvDataFormat("com.softedge.dto");
DataFormat bindy1 = new BindyCsvDataFormat("com.softedge.dto1");
from("file://TEST?fileName=order.csv&noop=true").
unmarshal(bindy).
marshal().
xstream().
to("file://TESTOUT?fileName=order.xml");
from("file://TEST?fileName=order_line.csv&noop=true").
unmarshal(bindy1).
marshal().
xstream().
to("file://TESTOUT?fileName=orderLine.xml");
Thread.sleep(100);
from("file://TESTOUT?idempotent=true?CamelBatchSize(2)noop=true")
.delayer(2000)
.doTry()
.aggregate(body(),new MyAggregationStrategy())
.completionTimeout(3000)
// .batchSize(2)
.log("aggregation test")
.to("file://TESTOUTA?fileName=aggregate.xml");
The out put file should contain the data from Order.xml, OrderLine.xml
Order.xml headers are
Orders Order_num Cust_Num Orderd Shipped Promised Carrier Terms PO
OrderLine.xml headers are
Line Order_num Line_num Item_num Price Qty Discount Extended_price BackOrder
Aggregation strategy
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
if (oldExchange == null) {
return newExchange;
}
Message newIn = newExchange.getIn();
String oldBody = oldExchange.getIn().getBody(String.class);
String newBody = newIn.getBody(String.class);
newIn.setBody("");
return newExchange;
}
ERROR Detailes
ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 299 seconds.
DefaultShutdownStrategy INFO Waiting as there are still 2 inflight and pending exchanges to complete, timeout in 298 seconds.
AggregateProcessor WARN Error processing aggregated exchange. Exchange[null]. Caused by: org.apache.camel.component.file.GenericFileOperationFailedException - Cannot store file: TESTOUTA\aggregate.xml
Cannot store file: TESTOUTA\aggregate.xml
The Output xml is in below format
aggregation.xml
format
Orders
Order_num
Line
Order_num
Line_num
Item_num
Price
Qty
Discount
Extended_price
BackOrder
Cust_Num
Orderd
Shipped
Promised Carrier
Terms
PO
Plese help me, very urgent