-
1. Re: How to consume a specific file with camel
davsclaus Aug 27, 2009 6:49 AM (in response to gvanstad)Which version of Camel are you using?
And what did you do that you think are not working? Eg post your route configuration.
And do you want to consume the file during a route or from the start?
-
2. Re: How to consume a specific file with camel
gvanstad Aug 27, 2009 7:23 AM (in response to davsclaus)Hi.
I'm using Fuse ESB 4.
I am doing everything in an OSGI bundle.
The route-ref is setup in my bundle-context.xml
I then use a java class that extends RouteBuilder to execute the route
basically, I want to:
detect a trigger file with a specific name (Starting point of my route)
consume 2 separate files with specific names
transform both files from fixed-width to XML
send transformed output to 2 seperate active MQ queues.
Here's my bundle-context.xml
-
3. Re: How to consume a specific file with camel
davsclaus Aug 27, 2009 8:49 AM (in response to gvanstad)Hi
Look at the Camel 1.x file documentation at:
Use the consumer.regexPattern to set a regular expression with the filename pattern you want to match.
For example: ^me.*xml$ to match files starting with me and ending with xml.
-
4. Re: How to consume a specific file with camel
gvanstad Aug 27, 2009 10:13 AM (in response to davsclaus)Great! Thanks!
One more question though:
my process is triggered by a file arriving in a folder. Once this file is consumed, I need to consume 2 specific files from the same folder and process them.
How would you approach a situation like this?
I understand that every from(...) starts a new route?
-
5. Re: How to consume a specific file with camel
davsclaus Aug 27, 2009 1:48 PM (in response to gvanstad)You dont have to shoehorn everything into Camel.
You could just read the files manually using a processor / pojo.
You can also use the Camel type converter to easily read the file
File file = new java.io.File("my file name goes here"); String context = exchange.getContext().getTypeConverter().convertTo(String.class, file);
You can also consume the files from a processor as shown in the FTP wiki page here:
http://camel.apache.org/ftp.html
In the section - Consuming a remote FTP server triggered by a route