camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Goyal, Arpit" <arpit.go...@sap.com>
Subject RE: Zip all files available in folder - synchronously
Date Tue, 01 Nov 2016 07:07:34 GMT
HI JB,

Can you elaborate a little. At least the code I have written below, I always see Aggregation
happening in separate thread and not main-thread. 

And which method you mean by stopping condition? Tried completionFromBatchConsumer and completionSize,
without any luck.

Regards,
Arpit.

-----Original Message-----
From: Jean-Baptiste Onofré [mailto:jb@nanthrax.net] 
Sent: Monday, October 31, 2016 11:14 PM
To: users@camel.apache.org
Subject: Re: Zip all files available in folder - synchronously

Hi Arpit,

The aggregate should work for that. All depends on the "stopping condition".

Regards
JB

On 10/31/2016 11:04 PM, Goyal, Arpit wrote:
> Hi Colleagues,
>
> I want to read all file and aggregate into one single zip, but the batch consumer always
run in different thread. What needs to be done additionally to get the response synchronously?
>
> Regards,
> Arpit.
>
>    DefaultCamelContext c = new DefaultCamelContext();
>     try {
>       c.addRoutes(new RouteBuilder() {
>
>         @Override
>         public void configure() throws Exception {
>           from("direct:start").from("file:/tmp/wiretap/6443391d-196a-4c75-b2f8-9c0696025b56/?include=.*&delete=true&maxMessagesPerPoll=2500")
>               .aggregate(body(), new CustomZipAggregationStrategy()).completionFromBatchConsumer().to("file:/tmp/wiretap/aggregate");
>         }
>       });
>
>       ProducerTemplate template = c.createProducerTemplate();
>       c.start();
>       template.start();
>       template.requestBody("direct:start", "BEGIN"); //synchronously response on completion
of zip construction...
>     } finally {
>       c.stop();
>     }
>
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Mime
View raw message