簡體   English   中英

ule子無法從SFTP位置下載文件

[英]Mule faile to download file from SFTP location

我正在嘗試連接到SFTP位置並使用Mule SFTP連接器下載.zip文件。 它看起來非常簡單,但是我不確定配置中缺少什么。 我無法弄清為什么它對我不起作用。 有人可以看看嗎,建議我應該做些什么改變才能工作?

在下面的流配置中,我從一個HTTP端點( http:// localhost:8181 / invoice )開始,然后調用了“ ftpconnectivityFlow1”,它檢查“ ftp”變量的值,並根據其值進入我的FTP位置或SFTP位置。 當我將變量“ ftp”設置為true時,它可以按預期工作,因為可以看到來自FTP位置的文件已下載到我的輸出文件夾中,並按預期從FTP位置刪除了。 當我將其設置為false時,它沒有給出任何錯誤,但是SFTP位置上的文件仍然存在,這意味着它無法讀取文件(我想是),並且也沒有下載到我的輸出文件夾中。 因此,對於某些調試,我添加了一個自定義轉換器,以便可以檢查有效負載。 在我的自定義轉換器中,我注意到當它連接到FTP位置時,它具有一些二進制數據(全數字),我猜它是我的.zip文件,但是當變量“ ftp”設置為false時,表示它正在嘗試連接到SFTP位置的情況下,有效負載包含“ / invoice”,這是我的http相對路徑。 因此,我的輸出文件夾包含一個名稱為“ null”的文件,並且包含的​​所有文件均為“ / invoice”

任何幫助是極大的贊賞。

<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"/>

您可能會將這些端口號倒退。 FTP通常在端口21上運行,SFTP(SSH)通常使用端口22。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM