Spring 如何轮询int:gateway以启动int ftp:outbound gateway?
首先感谢大家的关注Spring 如何轮询int:gateway以启动int ftp:outbound gateway?,spring,ftp,spring-integration,Spring,Ftp,Spring Integration,首先感谢大家的关注 我定义了出站网关ftp适配器来在目标服务器上运行ftp命令,我的目标是定期运行ls、mv、get,。。。服务器上的命令和批处理库作业上的运行任务,我的代码是: <bean id="ftpClientFactory1" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> <property name="host" value="127.0.0.
我定义了出站网关ftp适配器来在目标服务器上运行ftp命令,我的目标是定期运行ls、mv、get,。。。服务器上的命令和批处理库作业上的运行任务,我的代码是:
<bean id="ftpClientFactory1" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory">
<property name="host" value="127.0.0.1"/>
<property name="port" value="21"/>
<property name="username" value="banks_reader"/>
<property name="password" value="123456"/>
<property name="clientMode" value="2"/>
<property name="fileType" value="2"/>
</bean>
<int:gateway id="gw" service-interface="ir.ali.util.ToFtpFlowGateway"
default-request-channel="inbound1"/>
<int:channel id="inbound1"/>
<int-ftp:outbound-gateway id="gateway1"
session-factory="ftpClientFactory1"
request-channel="inbound1"
reply-channel="outbound"
reply-timeout="777"
auto-create-local-directory="false"
auto-startup="true"
filename-pattern="*"
remote-file-separator="/"
command="ls"
command-options="-dirs -R"
expression="payload"
mput-regex=".*"
>
</int-ftp:outbound-gateway>
<int:channel id="outbound">
<int:interceptors>
<int:wire-tap channel="logger"/>
</int:interceptors>
</int:channel>
<int:channel id="outboundJobRequestChannel"/>
<int:logging-channel-adapter id="logger" log-full-message="true" />
<int:transformer input-channel="outbound" output-channel="outboundJobRequestChannel">
<bean class="ir.ali.configuration.FileMessageToJobRequest"/>
</int:transformer>
<int:splitter id="splitter" input-channel="outbound" output-channel="ftpChannel"/>
<int:channel id="ftpChannel">
<int:queue/>
</int:channel>
它工作正常,问题是我需要定期运行ls和mv,,。。。服务器上的递归命令,如何运行toFtpFlow.lsGetAndRmFiles(“/”)
定期启动intftp:outbound gateway
<int:inbound-channel-adapter expression="/" channel="inbound1">
<int:poller fixed=delay="60000" />
</int:inbound-channel-adapter>
<int:channel id="inbound1"/>
<int-ftp:outbound-gateway id="gateway1"
session-factory="ftpClientFactory1"
request-channel="inbound1"
reply-channel="outbound"
reply-timeout="777"
auto-create-local-directory="false"
auto-startup="true"
filename-pattern="*"
remote-file-separator="/"
command="ls"
command-options="-dirs -R"
expression="payload"
mput-regex=".*"/>
谢谢@gary Russell,我需要在ftp服务器上运行递归ls命令,但int:inbound channel adapter
不支持它:(不-您误解了-这不是一个ftp入站通道适配器,只是一个简单的入站通道适配器,它将每隔60秒向inbound1
发送一条带有有效负载的消息。ftp网关将接收它,就像您的ToFtpFlowGateway
一样。它已工作:)@gary谢谢,我参与这件事已经两天了。我希望永远成功。
<int:inbound-channel-adapter expression="/" channel="inbound1">
<int:poller fixed=delay="60000" />
</int:inbound-channel-adapter>
<int:channel id="inbound1"/>
<int-ftp:outbound-gateway id="gateway1"
session-factory="ftpClientFactory1"
request-channel="inbound1"
reply-channel="outbound"
reply-timeout="777"
auto-create-local-directory="false"
auto-startup="true"
filename-pattern="*"
remote-file-separator="/"
command="ls"
command-options="-dirs -R"
expression="payload"
mput-regex=".*"/>