i have used sftp:inbound-streaming-channel-adapter with zookeeper.but it is giving me exception : java.lang.ClassCastException: com.jcraft.jsch.ChannelSftp$LsEntry cannot be cast to java.io.File. I am using the following code
<int-sftp:inbound-streaming-channel-adapter
id="sftpAdapter" channel="receiveChannel"
session-factory="cachingSessionFactory"
remote-file-separator="/" remote-directory-expression="'${ftpServerLoc}'" filter="compositeFilter"
auto-startup="true">
<int:poller fixed-rate="${pollarInterval}"
max-messages-per-poll="1" />
</int-sftp:inbound-streaming-channel-adapter>
<beans:bean id="compositeFilter"
class="org.springframework.integration.file.filters.CompositeFileListFilter">
<beans:constructor-arg>
<beans:list>
<beans:bean
class="org.springframework.integration.file.filters.RegexPatternFileListFilter">
<beans:constructor-arg value="^.*\.(dat|DAT)$" />
</beans:bean>
<beans:bean
class="org.springframework.integration.sftp.filters.SftpPersistentAcceptOnceFileListFilter">
<beans:constructor-arg name="store"
ref="metadataStore" />
<beans:constructor-arg value="" />
</beans:bean>
</beans:list>
</beans:constructor-arg>
</beans:bean>
The org.springframework.integration.file.filters.RegexPatternFileListFilter
should be org.springframework.integration.sftp.filters.SftpRegexPatternFileListFilter
.
The one you have applies to java.io.File
; the sftp version applies to LsEntry
(Jsch's representation of the remote file).