简体   繁体   English

ule子无法从SFTP位置下载文件

[英]Mule faile to download file from SFTP location

I am trying to connect to an SFTP location and download a .zip file using Mule SFTP connector. 我正在尝试连接到SFTP位置并使用Mule SFTP连接器下载.zip文件。 It looks very straightforward configuration, but I am not sure what is missing in my configuration. 它看起来非常简单,但是我不确定配置中缺少什么。 I am not able to make out why it is not working for me. 我无法弄清为什么它对我不起作用。 Can someone please look at it and suggest what should I change to make work? 有人可以看看吗,建议我应该做些什么改变才能工作?

In below flows configurations, I am starting with an HTTP end point ( http://localhost:8181/invoice ) then “ftpconnectivityFlow1” is called and it checks the value of "ftp" variable and based on its value it either goes to my FTP location or SFTP location. 在下面的流配置中,我从一个HTTP端点( http:// localhost:8181 / invoice )开始,然后调用了“ ftpconnectivityFlow1”,它检查“ ftp”变量的值,并根据其值进入我的FTP位置或SFTP位置。 when I set the variable "ftp" to true it works as expected, as I can see file from FTP location is downloaded in my output folder and deleted from FTP location as expected. 当我将变量“ ftp”设置为true时,它可以按预期工作,因为可以看到来自FTP位置的文件已下载到我的输出文件夹中,并按预期从FTP位置删除了。 When I set it to false it is not giving any error but file at SFTP location is still there meaning it is not able to read file (I am guessing) and it is not downloaded to my output folder. 当我将其设置为false时,它没有给出任何错误,但是SFTP位置上的文件仍然存在,这意味着它无法读取文件(我想是),并且也没有下载到我的输出文件夹中。 So for some debugging I added a custom transformer so that I can inspect payload. 因此,对于某些调试,我添加了一个自定义转换器,以便可以检查有效负载。 In my custom transformer I notice that when it connects to FTP location it has some binary data (all number), I am guessing it is my .zip file, but when variable "ftp" is set to false, meaning it is trying to connect to SFTP location in that case payload contains "/invoice" which is my http relative path. 在我的自定义转换器中,我注意到当它连接到FTP位置时,它具有一些二进制数据(全数字),我猜它是我的.zip文件,但是当变量“ ftp”设置为false时,表示它正在尝试连接到SFTP位置的情况下,有效负载包含“ / invoice”,这是我的http相对路径。 So my output folder contains a file with name “null” and all it contains is "/invoice" 因此,我的输出文件夹包含一个名称为“ null”的文件,并且包含的​​所有文件均为“ / invoice”

Any help is greatly appreciated. 任何帮助是极大的赞赏。

<flow name="ftpconnectivityFlow1">

    <logger message="ftp:#[message.outboundProperties['ftp']]" doc:name="Logger" level="INFO"/>
    <choice doc:name="Choice">
        <when expression="#[message.outboundProperties['ftp']==true]">
            <flow-ref name="FTPConnection" doc:name="FTPFileDownloadConnection"/>
        </when>
        <otherwise>
            <flow-ref name="SFTPConnection" doc:name="SFTPFileDownloadConnection"/>
        </otherwise>
    </choice>
</flow>

<flow name="FTPConnection">
    <ftp:inbound-endpoint host="host" port="22" path="abc" user="user" password="password" responseTimeout="10000" doc:name="FTP"/>
   <custom-transformer class="abc.transformer.CustomeFileTransformer" />
    <logger message="connected to FTP" level="INFO" doc:name="Logger"/>
     <file:outbound-endpoint path="output" outputPattern="#[message.inboundProperties['originalFilename']]" responseTimeout="10000" doc:name="File"/>
</flow>

<flow name="SFTPConnection">
     <sftp:inbound-endpoint     connector-ref="sftp-default"  doc:name="SFTP"    responseTimeout="10000" host="host" password="password" path="/Inbound" port="21" user="user"/>
    <custom-transformer class="abc.transformer.CustomeFileTransformer" />

     <logger level="INFO" doc:name="Logger"/>
    <file:outbound-endpoint path="output" outputPattern="#[message.inboundProperties['originalFilename']]" responseTimeout="10000" doc:name="File"/>

</flow>
<ftp:inbound-endpoint host="host" port="22" ... doc:name="FTP"/>
...
 <sftp:inbound-endpoint ... port="21" user="user"/>

You might have those port numbers backwards. 您可能会将这些端口号倒退。 FTP normally runs on port 21 and SFTP (SSH) normally uses port 22. FTP通常在端口21上运行,SFTP(SSH)通常使用端口22。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM