Camel执行端点&路线

时间:2016-12-20 17:46:43

标签: xml apache-camel endpoint

我想扫描包含子文件夹的文件夹,这是我的配置

Source

-- Center_A

  -- Target

-- Center_B

  -- Target
.....

我的问题:

  1. 如何扫描来源/中心*(没有子文件夹目标)

  2. 如何在Source / Center_A / Target中的Source / Center_A中路由扫描的文件 并在Source / Center_B / Target

  3. 中路由Source / Center_B

    我的camel-context.xml

        <endpoint id="dossierin" uri="file:Source/Center*" />
    
         <route>
            <from ref="dossierin" />
            <to uri="${file:dossierin}/Target" />
        </route>
    

    编辑1:

    第一期修正

    <endpoint id="dossierin" uri="file:Source?recursive=true&amp;maxDepth=1"/>
    

    编辑2:

    第二个问题已修复

    <camelContext id="camelCtx" xmlns="http://camel.apache.org/schema/spring">
        <endpoint id="repoOutA" uri="file:work/outA" />
        <route>
            <from uri="file:Source?recursive=true&amp;maxDepth=2&amp;move=Target" />
            <to ref="repoOutA"/>
        </route>
    </camelContext>
    

    最后一个问题,移动选项已足够我不想使用

      <to ...>
    

    这可能吗?

1 个答案:

答案 0 :(得分:0)

1) 文件组件允许配置最小和最大深度,您可以使用该深度限制仅向下扫描2个深度(1 =基础目录,2 =第一个子目录)。并设置recursive = true。

请参阅文档:http://camel.apache.org/file2

2)不明白你的问题。