TheGuyNextDoor
TheGuyNextDoor

Reputation: 7937

Pause directory until after unzipping is complete

I have a ZIP file with multiple files about 1GB each. Unzipping is done by one route (Route1) that polls the download directory and saves files to the extract directory. Another route (Route2) polls the extract directory to process the files.

These files are supposed to be processed in a certain sequence (Route2 uses sortBy when getting the files). Route2 immediately picks files that are still being unzipped before all the files are available.

How can i pause Route2 from processing until after Route1 is done unzipping the files.

Upvotes: 1

Views: 237

Answers (3)

Ralf
Ralf

Reputation: 6853

Can you write a done-file in your first route once the unzip process has finished and then use the "doneFileName" URI option of the File2 component in your second route?

Upvotes: 1

Claus Ibsen
Claus Ibsen

Reputation: 55525

You can pickup one file at a time in route 1 with maxMessagesPerPoll=1, and then use the control bus component to stop the route, and then from the other route, start the route again. http://camel.apache.org/controlbus.html

Upvotes: 0

Ion Cojocaru
Ion Cojocaru

Reputation: 2583

Take a look at readLock and readLockInterval parameters in the File2 component.

Upvotes: 0

Related Questions