发布于2023-03-30 19:01 阅读(376) 评论(0) 点赞(19) 收藏(3)
我是 apache 骆驼的新手。我想从服务混合文件轮询器迁移到骆驼文件轮询器。我正在尝试这样做,但目前我没有什么可测试的,因为我必须对此进行编码并让某人进行测试。那么有人可以帮助我并检查我是否以正确的方式进行吗?
服务混合文件轮询器代码:
<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 文件轮询器
<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 the camel coding. I have left with destination part. And I have no idea about the marshaler
that is used in the service-mix
part. How to implement that BinaryFileMarshaler
using camel.
你可以在 Apache Camel 中更容易地做到这一点,你可以在文件端点中配置过滤,所以它就变成了
<route>
<from uri="file:D:/input?delay=20000&include=A.*ID"/>
<to uri="file:D:/archive"/>
</route>
请注意,include 选项使用正则表达式,因此如果您不熟悉它,可能需要尝试让表达式按预期工作。但是它的标准java正则表达式。
查看更多信息:https ://camel.apache.org/components/latest/file-component.html
对于 Apache Camel 的新用户,请参阅:http ://java.dzone.com/articles/open-source-integration-apache
作者:黑洞官方问答小能手
链接:http://www.javaheidong.com/blog/article/666433/9af0e70b823093c8850b/
来源:java黑洞网
任何形式的转载都请注明出处,如有侵权 一经发现 必将追究其法律责任
昵称:
评论内容:(最多支持255个字符)
---无人问津也好,技不如人也罢,你都要试着安静下来,去做自己该做的事,而不是让内心的烦躁、焦虑,坏掉你本来就不多的热情和定力
Copyright © 2018-2021 java黑洞网 All Rights Reserved 版权所有,并保留所有权利。京ICP备18063182号-2
投诉与举报,广告合作请联系vgs_info@163.com或QQ3083709327
免责声明:网站文章均由用户上传,仅供读者学习交流使用,禁止用做商业用途。若文章涉及色情,反动,侵权等违法信息,请向我们举报,一经核实我们会立即删除!