Obtaining file name in camel file binding
jdestef Jul 2, 2012 10:32 PMHi,
I'm using SwitchYard 0.5. I have a camel binding to watch a directory for new files. The files have a common file suffix but the name varies. Using the include property to filter for the required files as follows (regex in bold - .*\.hl7):
<?xml version="1.0" encoding="UTF-8"?>
<switchyard xmlns="urn:switchyard-config:switchyard:1.0" xmlns:bean="urn:switchyard-component-bean:config:1.0" xmlns:camel="urn:switchyard-component-camel:config:1.0" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" name="file_to_email" targetNamespace="urn:com.example.switchyard:file_to_email:0.0.1-SNAPSHOT">
<sca:composite name="file_to_email" targetNamespace="urn:com.example.switchyard:file_to_email:0.0.1-SNAPSHOT">
<sca:component name="FilePickupServiceBean">
<bean:implementation.bean class="org.hitect.esb.file_to_email.FilePickupServiceBean"/>
<sca:service name="FilePickupService">
<sca:interface.java interface="org.hitect.esb.file_to_email.FilePickupService"/>
</sca:service>
<sca:reference name="MailService">
<sca:interface.java interface="org.hitect.esb.file_to_email.MailService"/>
</sca:reference>
</sca:component>
<sca:service name="FilePickupService" promote="FilePickupServiceBean/FilePickupService">
<sca:interface.java interface="org.hitect.esb.file_to_email.FilePickupService"/>
<camel:binding.file>
<camel:directory>/Users/johndestefano/TestFilePickup</camel:directory>
<camel:consume>
<camel:include>%2e*%5c%2ehl7</camel:include>
<camel:preMove>move/%24%7bdate:now:MMddyyyyhhmmss%7d.hl7</camel:preMove>
<camel:maxMessagesPerPoll>1</camel:maxMessagesPerPoll>
</camel:consume>
</camel:binding.file>
</sca:service>
<sca:component name="MailServiceBean">
<bean:implementation.bean class="org.hitect.esb.file_to_email.MailServiceBean"/>
<sca:service name="MailService">
<sca:interface.java interface="org.hitect.esb.file_to_email.MailService"/>
</sca:service>
</sca:component>
</sca:composite>
</switchyard>
In the FilePickupServiceBean there is a method that processes the file text. During the processing I'd like to know what the real name of the file was as its filtered based on a regex. Is there a way to find that out?
Thanks