You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by cwhistler <ch...@sungard.com> on 2013/05/14 20:51:56 UTC

Making a route depend on multiple criteria

I need a way to create a Camel route that uses a file "from" endpoint but
cannot start processing that file until some other things are complete.  So
here's a simplified scenario just to provide an example:

A camel route extracts data from a database and writes the records to a file
on the file system.

A second camel route has a file endpoint watching for the extract file. 
When it is available it will transform the records in that file and write
out a new file.  The original file will be moved to a "hold" folder.

A third route watches for the transformed file to do something with it,
maybe send it off the system somewhere.  When this one is done it will move
the file to a "done" folder.

A fourth route needs to process the "hold" file from the second route, but
it cannot process this file until the transformed file has moved to the
"done" folder.  So is there a way to make this fourth route dependent on
both the "hold" and the "done" files?  It does not have to process the
"done" file, it just can't do anything with the "hold" file until the third
route is done.



--
View this message in context: http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Making a route depend on multiple criteria

Posted by kalyan <re...@gmail.com>.
I'm a newbie here. But what ever you described may be handled with multiple
routes. Use "direct:" for synchronous and "seda:" for asynchronous routing
as described in documentation for joining all the routes you create.



--
View this message in context: http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515p5732517.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Making a route depend on multiple criteria

Posted by cwhistler <ch...@sungard.com>.
I'm a bit concerned about performance and memory management with enriching
the existing route.  That would in effect hold 2 files in memory wouldn't
it?

I think I will just configure that last route but not start it.  I'll use
the onCompletion API on the third route to start the fourth route.



--
View this message in context: http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515p5732602.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Making a route depend on multiple criteria

Posted by boday <be...@initekconsulting.com>.
sounds like you could just explicitly invoke the 4th route (direct:route4) at
the end of the 3rd route and enrich the 4th route with the "hold" file...see
http://camel.apache.org/content-enricher.html


cwhistler wrote
> I need a way to create a Camel route that uses a file "from" endpoint but
> cannot start processing that file until some other things are complete. 
> So here's a simplified scenario just to provide an example:
> 
> A camel route extracts data from a database and writes the records to a
> file on the file system.
> 
> A second camel route has a file endpoint watching for the extract file. 
> When it is available it will transform the records in that file and write
> out a new file.  The original file will be moved to a "hold" folder.
> 
> A third route watches for the transformed file to do something with it,
> maybe send it off the system somewhere.  When this one is done it will
> move the file to a "done" folder.
> 
> A fourth route needs to process the "hold" file from the second route, but
> it cannot process this file until the transformed file has moved to the
> "done" folder.  So is there a way to make this fourth route dependent on
> both the "hold" and the "done" files?  It does not have to process the
> "done" file, it just can't do anything with the "hold" file until the
> third route is done.





-----
Ben O'Day
IT Consultant -http://consulting-notes.com

--
View this message in context: http://camel.465427.n5.nabble.com/Making-a-route-depend-on-multiple-criteria-tp5732515p5732566.html
Sent from the Camel - Users mailing list archive at Nabble.com.