Hi,

I have created route below where files are stored on source/files directory
by some other process and I wouldn't know the file name. My camel app will
read any file name from the directory. While doing this, it utilizes
flatpack Fixed length component to parse file content and routes it to bean
for tranformation. When it comes to bean (mapFileBean), I am unable to get
the file name from the Exchange object. I  need the filename to determine
few cases. How can I pass the file name from different routes? I have tried
to use setHeader as shown below and when it comes to bean it doesn't have
CamelFileName in the header property. Any suggestions with getting file name
in transformFromFiletoJavaObject route? I am using Camel 2.3.

                <route id="readFile" startupOrder="2" shutdownRoute="Defer">

                <from
uri="file://source/files?delete=false&exclude=.done&move=.done&autoCreate=false"/>
<setHeader headerName="CamelFileName">
                  <constant>${file:onlyname.noext}</constant>
                </setHeader>
                <to
uri="flatpack:fixed:META-INF/flatpack/FileFixedLength.pzmap.xml"/>
                </route>
                <route id="transformFromFiletoJavaObject" startupOrder="1"
shutdownRoute="Defer">
                        <from
uri="flatpack:fixed:META-INF/flatpack/CTSFixedLength.pzmap.xml"/>
                       
                        <to
uri="bean:mapFileBean?method=mapFileToJavaObject"/>
                </route>

Kind regards,
-Vid- 
-- 
View this message in context: 
http://camel.465427.n5.nabble.com/Set-Filename-in-the-header-property-tp2264943p2264943.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to