You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Willem jiang <wi...@gmail.com> on 2012/09/03 05:18:12 UTC

Re: aggregation failed

How did you shutdown the camel context?
It looks like you need to wait for the aggregation to aggregate the XML for you before shutdown the camel context.

-- 
Willem Jiang

FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang





On Friday, August 31, 2012 at 5:27 PM, vasukfuse wrote:

> 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 (http://Nabble.com).




Re: aggregation failed

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You posted this question on other forums as well. Please tell us when
you do that, as then the talk gets splitted
http://fusesource.com/forums/thread.jspa?threadID=4226&tstart=0


On Mon, Sep 3, 2012 at 12:40 PM, vasukfuse <va...@gmail.com> wrote:
> Hi willem,
>
> Thanks for reply,
>
> Could you please provide me the code for this Aggregation
>
> And  the DataFormat(bean) ,to achieve the required format xml (mentioned
> above post).
>
> As I am new to camel, I need code example.
>
> Thanks
>
> vasu
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/aggregation-failed-tp5718468p5718540.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: aggregation failed

Posted by vasukfuse <va...@gmail.com>.
Hi willem,

Thanks for reply,

Could you please provide me the code for this Aggregation 

And  the DataFormat(bean) ,to achieve the required format xml (mentioned
above post).

As I am new to camel, I need code example.

Thanks 

vasu 



--
View this message in context: http://camel.465427.n5.nabble.com/aggregation-failed-tp5718468p5718540.html
Sent from the Camel - Users mailing list archive at Nabble.com.