我对Camel相对较新,并且猜测我的问题可以通过FlatPack和聚合的组合来解决,但我没有看到如何在不编写大量代码的情况下使其工作。
它以带有2列的固定宽度文件开头(实际上只有2列相关): action_id 和 organisation_id 。该文件包含几千行,可以包含重复项。
需要2件事:
如果有人有解决方案或能指出我正确的方向,我们将不胜感激。
干杯, 汤姆
更新:
正如克劳斯易卜生所提到的,这也在骆驼论坛上进行了讨论和回答。 我的解决方案就是这个
<bean id="organisationMemoryRepository"
class="org.apache.camel.processor.idempotent.MemoryIdempotentRepository" />
...
<route id="process-line">
<from uri="flatpack:fixed:kbo.pzmap.xml" />
<convertBodyTo type="java.util.Map"/>
<filter>
<ognl>request.body["ACTION"] == "070"</ognl>
<idempotentConsumer messageIdRepositoryRef="organisationMemoryRepository">
<ognl>request.body["ORGANISATION"]</ognl>
<to uri="log:be.roots.organisation?level=INFO" />
</idempotentConsumer>
</filter>
</route>