0
votes

I use spring integration 4.2.6.RELEASE and try to create custom file watcher

something like this:

 <int-file:inbound-channel-adapter id="filesInAdapter" directory="#{pojoUtil.sourceRootDir}" auto-create-directory="true"
                                  channel="filesInChannel" scanner="watchDirectoryScanner" auto-startup="true">
    <int:poller ref="globalPoller"/>
</int-file:inbound-channel-adapter>


<!-- directory scanner org.springframework.integration.file.WatchServiceDirectoryScanner -->
<!--id.lsa.scb.spring.integration.scanner.CustomScanner-->
<bean id="nioLocker" class="org.springframework.integration.file.locking.NioFileLocker"/>

<bean id="watchDirectoryScanner" class="id.lsa.scb.spring.integration.scanner.AdrFileScanner">
    <constructor-arg value="#{pojoUtil.sourceRootDir}"/>
    <property name="autoStartup" value="true"/>
    <property name="filter" ref="compositeFilter"/>
    <property name="locker" ref="nioLocker"/>
    <property name="adrUtil" ref="pojoUtil"/>
</bean>

How to ignore directory tag element in int-file:inbound-channel-adapter? Because I thought we don't need that if the directory initiated in custom the file scanner. I have customize the file scanner so it can registering a list of directory into file watcher without need to watch the root of that list.

1

1 Answers

1
votes

This has been resolved in 4.3 which should be released in the next week or so. It's available in the release candidate.

For now, you need to specify the directory in both places.