Hi All
i have to aggregate two XML files which are available at different
times.But I am getting error in aggregation part
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("<ORDERS>"+ oldBody + newBody+"</ORDERS>");
return newExchange;
}
ERROR Detailes
*ShutdownTask] DefaultShutdownStrategy INFO Waiting as there are still 2
inflight and pending exchanges to complete, timeout in 299 seconds.
[el-1) thread #5 - ShutdownTask] DefaultShutdownStrategy INFO
Waiting as there are still 2 inflight and pending exchanges to complete,
timeout in 298 seconds.
[d #1 - AggregateTimeoutChecker] 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.
vasu
--
View this message in context:
http://camel.465427.n5.nabble.com/aggregation-failed-tp5718468.html
Sent from the Camel - Users mailing list archive at Nabble.com.