java - Migrating from service-mix file poller to apache camel file poller -
i new apache camel. want migrate service mix file poller camel file poller. trying it, have nothing test have code , give testing. can me , check whether going in right way?
service-mix file poller code:
<sm:activationspec componentname="abcfilepoller" destinationservice="b:destinationa" service="b:abcfilepoller"> <sm:component> <bean class="org.apache.servicemix.components.file.filepoller"> <property name="file" value="file://d:/input" /> <property name="period" value="20000"/> <property name="archive" value="file://d:/archive" /> <property name="filter" ref="abcfilefilter" /> <property name="marshaler"> <bean class="org.apache.servicemix.components.util.binaryfilemarshaler" /> </property> </bean> </sm:component> </sm:activationspec> <sm:activationspec componentname="destinationa" service="b:destinationa"> <sm:component> <bean class="com.abc.file.abcreceivercomponent"> </bean> </sm:component> </sm:activationspec> <bean id="abcfilefilter" class="org.apache.commons.io.filefilter.wildcardfilefilter"> <constructor-arg value="a*.id" />
apache camel file poller
<camel:route id="abcfilepoller"> <camel:from uri="timer://time?period=20000"/> <camel:pollenrich uri="file://d:/input"/> <camel:filter ref="abcfilefilter"></camel:filter> <camel:to uri="file://d:/archive" /> <camel:to uri="" /> </camel:route> <bean id="abcfilefilter" class="org.apache.commons.io.filefilter.wildcardfilefilter"> <constructor-arg value="a*.id" /> </bean>
i have not completed camel coding. have left destination part. , have no idea marshaler
used in service-mix
part. how implement binaryfilemarshaler
using camel.
you can easier in apache camel can configure filtering in file endpoint, becomes
<route> <from uri="file:d:/input?delay=20000&include=a.*id"/> <to uri="file:d:/archive"/> </route>
just mind include option uses regular expression, if not familiar can take bit tries expression work expected. standard java regular expressions.
see more at: http://camel.apache.org/file2
and new users apache camel see: http://java.dzone.com/articles/open-source-integration-apache
Comments
Post a Comment