使用mule flow将文件从sftp服务器传输到另一个sftp服务器

使用mule flow将文件从sftp服务器传输到另一个sftp服务器,mule,sftp,Mule,Sftp,我想用多路径从sftp服务器传输文件,我在一个项目中配置了十个这样的流,它们将访问一个sftp服务器上的不同路径,同时将文件传输到另一个sftp服务器的不同路径。但当我运行这个项目时,它返回“SSH_MSG_DISCONNECT:2此IP的用户太多”,我如何解决这个问题,或者有更好的方法来满足这个要求。 有什么建议吗?谢谢,您可以使用foreach+动态端点的组合来实现这一点,但缺点是您需要在入站端点之后禁用SFTP连接器中的流(或使用对象到流转换器),即 <flow name="test

我想用多路径从sftp服务器传输文件,我在一个项目中配置了十个这样的流,它们将访问一个sftp服务器上的不同路径,同时将文件传输到另一个sftp服务器的不同路径。但当我运行这个项目时,它返回“SSH_MSG_DISCONNECT:2此IP的用户太多”,我如何解决这个问题,或者有更好的方法来满足这个要求。
有什么建议吗?谢谢,您可以使用foreach+动态端点的组合来实现这一点,但缺点是您需要在入站端点之后禁用SFTP连接器中的流(或使用对象到流转换器),即

<flow name="test1" doc:name="test1">
    <sftp:inbound-endpoint host="${source.server.host}"
        port="${source.server.port}" path="${source.server.customer.path}" user="${source.server.user}"
        password="${source.server.password}" responseTimeout="10000"
        pollingFrequency="${source.server.pollfrequency}" doc:name="source SFTP server" connector-ref="SFTPone"/>
    <sftp:outbound-endpoint exchange-pattern="one-way"
        outputPattern="#[message.inboundProperties['originalFilename']]"
        host="${target.server.host}" port="${target.server.port}" path="${target.server.customer.path}"
        user="${target.server.user}" password="${target.server.password}"
        responseTimeout="10000" doc:name="Intermediate Host" connector-ref="TARGETSFTPone"/>
</flow>
<flow name="test2" doc:name="test2">
    <sftp:inbound-endpoint host="${source.server.host}"
        port="${source.server.port}" path="${source.server.wells.path}" user="${source.server.user}"
        password="${source.server.password}" responseTimeout="10000"
        pollingFrequency="${source.server.pollfrequency}" doc:name="source SFTP server" connector-ref="SFTPtwo"/>
    <sftp:outbound-endpoint exchange-pattern="one-way"
        outputPattern="#[message.inboundProperties['originalFilename']]"
        host="${target.server.host}" port="${target.server.port}" path="${target.server.wells.path}"
        user="${target.server.user}" password="${target.server.password}"
        responseTimeout="10000" doc:name="Intermediate Host" connector-ref="TARGETSFTPtwo"/>
</flow>


您可能需要修改语法,但逻辑就是这样。

谢谢您的回答,Juan。根据您的流配置,流可以在sftpA的路径(A)到sftpB的路径(A)、路径(B)、路径(C)…上执行文件传输,是否正确?但我的要求是这样的:将sftpA路径(A)上的文件传输到sftpB路径(A),将sftpA路径(B)上的文件传输到sftpB路径(B),同时将sftpA路径(C)上的文件传输到sftpB路径(C)。有什么建议吗??非常感谢!您可以根据需要更改用户名和主机名,并调用explicity。
<sftp:inbound endpoint>
<object-to-byte-array />
<set-variable variableName="fileContents" value="#[payload]" />
<foreach value="#[expressionToTheListOfSites]">
    <set-variable variableName="site" value="#[payload]" />
    <set-payload value="#[fileContents]" />
    <sftp:outbound-endpoint address="sftp://#[site]" />
</foreach>
Inbound:

EndpointBuilder endpointBuilder = eventContext
                .getMuleContext()
                .getEndpointFactory()
                .getEndpointBuilder(
                        "sftp"+"://" + userName+ ":"
                                + password+ "@"
                                + host+ ":"+port
                                + path+"?connector=SFTPIN");

 InboundEndpoint inboundEndPoint = endpointBuilder.buildInboundEndpoint();

    endpointBuilder.addMessageProcessor(new MessageFilter(new WildcardFilter("sample*")));

    endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);

    MuleMessage message= inboundEndPoint.request(1000000L);

outbound:

//To send file to destination 
    EndpointBuilder outboundEndpointBuilder = eventContext
            .getMuleContext()
            .getEndpointFactory()
            .getEndpointBuilder(
                    "sftp"+"://" + userName+ ":"
                            + password+ "@"
                            + host+ ":"+port
                            + path+"?connector=SFTPOUT");

    OutboundEndpoint outboundPoint=outboundEndpointBuilder.buildOutboundEndpoint();

    SftpConnector sftpConnector=(SftpConnector) outboundPoint.getConnector();

    sftpConnector.setOutputPattern("sample1.txt");
    eventContext.getMuleContext().getClient().process(outboundPoint, msg);