我的要求似乎很简单。我需要轮询单个目录并根据我需要的输入文件的文件名;
a) 设置标头值 b) 将消息定向到特定的 JMS 队列
我已经尝试了几种不同的方法来实现这一点,但根据文档,followng 应该可以工作.. 显然对我来说不是......
<from uri="file:[some input directory]"/>
<when>
<simple>${file:name} contains 'new'</simple>
<setHeader headerName="messageType">
<constant>NEW</constant>
</setHeader>
<to uri="jmsbroker:queue:[queue for new items]"/>
</when>
<when>
<simple>${file:name} contains 'amend'</simple>
<setHeader headerName="messageType">
<constant>AMEND</constant>
</setHeader>
<to uri="jmsbroker:queue:[queue for amended items]"/>
</when>
<when>
<simple>${file:name} contains 'other'</simple>
<setHeader headerName="messageType">
<constant>OTHER</constant>
</setHeader>
<to uri="jmsbroker:queue:[queue for other]"/>
</when>
<otherwise>
<bean ref="deadLetterErrorHandler"/>
</otherwise>
</route>
非常感谢任何帮助。
问候,安迪