【问题标题】:Mule SFTP to File flow occasionally produces a corrupted pgp fileMule SFTP 到文件流偶尔会产生损坏的 pgp 文件
【发布时间】:2013-12-12 05:57:10
【问题描述】:

使用 Mule 3.2.1,我们遇到了一个奇怪的问题,我们使用 SFTP 组件从服务器获取 pgp 加密报告文件。我们使用 SFTP 组件归档文件,然后使用 file:endpoint 生成工作副本以供进一步处理。

我们的问题是,文件的工作副本每隔一段时间就会损坏,但 SFTP 归档文件是好的。在十六进制编辑器中查看损坏的文件时,我们会看到好字节,然后突然间,我们看到文件其余部分的空字节。 Mule 复制时,基础文件似乎已被删除。

另一个令人困惑的信息是,我们尝试再次下载失败的文件,并且一切正常。这使我相信问题不是文件中的某些内容,但显然我们确实有一个文件似乎始终失败。所有这些事情都发生在生产服务器上,其中包含我无权访问的文件。

在不了解 Mule 的内部工作原理的情况下,我不知道什么条件会导致此问题。

有没有足够熟悉 Mule 内部运作的聪明人来冒险猜测一下?

另外,我们不是 Mule 专家,欢迎对我们的 Mule 配置提出任何批评。 (顺便说一句,下面的配置是生产中的修改版本和更频繁的轮询等)

<sftp:connector name="SftpConnector" validateConnections="true" autoDelete="true">
    <file:expression-filename-parser />
</sftp:connector>

<file:connector name="FileConnector" pollingFrequency="1000" fileAge="1000" streaming="false"
    autoDelete="false">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
    <file:expression-filename-parser />
</file:connector>

<sftp:endpoint name="SftpEndpoint" connector-ref="SftpConnector" host="localhost"
    port="22" user="tdr" password="password" path="/opt/tdr/outbound" archiveDir="/home/cps/mule/sftp-archive"
    responseTimeout="30000" sizeCheckWaitTime="2500" disableTransportTransformer="true">
    <file:filename-wildcard-filter pattern="*.pgp,*.gpg" />
</sftp:endpoint>

<file:endpoint name="FileEndpoint" connector-ref="FileConnector" path="/home/cps/mule/input" />

<flow name="DfrFileGrabber">
    <quartz:inbound-endpoint jobName="ptDfrGrabber" cronExpression="0/2 * * * * ?">
        <quartz:endpoint-polling-job>
            <quartz:job-endpoint ref="SftpEndpoint" />
        </quartz:endpoint-polling-job>
    </quartz:inbound-endpoint>

    <file:outbound-endpoint ref="FileEndpoint" outputPattern="#[header:originalFilename]" />
</flow>

【问题讨论】:

    标签: mule


    【解决方案1】:

    我想我们已经查到了这个问题的底部。我不能保证我的测试用例会重复我们在生产中看到的问题,但我相信问题的根源在于,如果要复制的文件足够大,石英计时器可能会在前一个之前启动sftp 复制已完成,导致使用相同的文件名出现多个副本。

    一种解决方案是在 SFTP 连接中包含 tempDir 属性。这会导致 SFTP 连接在进行复制时将正在检索的文件移动到服务器上的 tempDir 目录中。因此,如果石英计时器在第一个副本完成之前触发,它不会找到相同的文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-10-31
      • 2020-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-21
      • 2019-10-04
      相关资源
      最近更新 更多