骆驼:Flatpack&聚合

时间:2013-08-06 11:16:54

标签: apache-camel aggregate fixed-width flatpack

我对Camel相对较新,并且猜测我的问题可以通过FlatPack和聚合的组合来解决,但我没有看到如何在不编写大量代码的情况下使其工作。

它以带有2列的固定宽度文件开头(实际上只有2列相关): action_id organisation_id 。该文件包含几千行,可以包含重复项。

需要2件事:

  1. 过滤掉特定action_id的行(我们只对action_id 70感兴趣)
  2. 基于organisation_id进行重复数据删除(同一组织可以出现在多行中)
  3. 如果有人有解决方案或能指出我正确的方向,我们将不胜感激。

    干杯, 汤姆

    更新:

    正如克劳斯易卜生所提到的,这也在骆驼论坛上进行了讨论和回答。 我的解决方案就是这个

    <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>
    

0 个答案:

没有答案