Camel perform endpoint & route

232 views Asked by At

I want to scan folder with subfolders, this is my configuration

Source

-- Center_A

  -- Target

-- Center_B

  -- Target
.....

My questions:

  1. How to scan Source/Center* (without subfolders Target)

  2. How to route files scanned in Source/Center_A in Source/Center_A/Target and route Source/Center_B in Source/Center_B/Target

My camel-context.xml

    <endpoint id="dossierin" uri="file:Source/Center*" />

     <route>
        <from ref="dossierin" />
        <to uri="${file:dossierin}/Target" />
    </route>

EDIT 1 :

First issue fixed

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

EDIT 2 :

Second issue fixed

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

The last problem, move option is sufficient I don't want to use

  <to ...>

is this possible?

1

There are 1 answers

2
Claus Ibsen On BEST ANSWER

1) The file component allows to configure the min and max depth which you can use to limit to only scan down 2 levels deep (1=base dir, 2=first sub dir). And set the recursive=true as well.

See the documentation: http://camel.apache.org/file2

2) Dont understand your question.