JIRA

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Use Agile By Default
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Create Issue
  • Mule
  • MULE-3859

FTP transport doesn't support streaming

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Patch submission Patch submission
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 2.0.2
  • Fix Version/s: Product Backlog
  • Component/s: Transport: FTP / SFTP
  • Labels:
    None
  • Environment:

    All plattforms

  • User impact:
    Medium
  • Similar Issues:
    None

Description

The FTP transport currently doesn't support streaming, that causes an OutOfMemory error getting large files from ftp server.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Java Source File
    FtpMessageRequester.java
    11/Nov/09 09:08 PM
    5 kB
    Cheng Lee

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions
  • Commits
  • Source
  • Builds
Hide
Permalink
Travis Carlson added a comment - 22/May/09 05:16 PM

Danny, can this be closed now?

Show
Travis Carlson added a comment - 22/May/09 05:16 PM Danny, can this be closed now?
Hide
Permalink
Cheng Lee added a comment - 11/Nov/09 09:08 PM

In version 2.2.1 of FtpMessageReceiver I see the streaming support. However, the issue is still present on FtpMessageRequester as you can see below:

org.mule.transport.ftp.FtpMessageRequester:119

ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (!client.retrieveFile(file.getName(), baos))

It should take the same approach as FtpMessageReceiver which asks whether the connector is in "streaming" mode and invoke FtpClient.retrieveFileStream() instead. Basically this:

MuleMessage reply;
if (connector.isStreaming())
{
InputStream stream = client.retrieveFileStream(file.getName());
if (stream == null)
{
throw new IOException(MessageFormat.format("Failed to retrieve file {0}. Ftp error: {1}",
file.getName(), client.getReplyCode()));
}
reply = new DefaultMuleMessage(connector.getMessageAdapter(stream));
}
else
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
if (!client.retrieveFile(file.getName(), baos))

{ throw new IOException("Ftp error: " + client.getReplyCode()); }

reply = new DefaultMuleMessage(connector.getMessageAdapter(baos.toByteArray()));
}

I've attached the patched file for version 2.2.1

Show
Cheng Lee added a comment - 11/Nov/09 09:08 PM In version 2.2.1 of FtpMessageReceiver I see the streaming support. However, the issue is still present on FtpMessageRequester as you can see below: org.mule.transport.ftp.FtpMessageRequester:119 ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (!client.retrieveFile(file.getName(), baos)) It should take the same approach as FtpMessageReceiver which asks whether the connector is in "streaming" mode and invoke FtpClient.retrieveFileStream() instead. Basically this: MuleMessage reply; if (connector.isStreaming()) { InputStream stream = client.retrieveFileStream(file.getName()); if (stream == null) { throw new IOException(MessageFormat.format("Failed to retrieve file {0}. Ftp error: {1}", file.getName(), client.getReplyCode())); } reply = new DefaultMuleMessage(connector.getMessageAdapter(stream)); } else { ByteArrayOutputStream baos = new ByteArrayOutputStream(); if (!client.retrieveFile(file.getName(), baos)) { throw new IOException("Ftp error: " + client.getReplyCode()); } reply = new DefaultMuleMessage(connector.getMessageAdapter(baos.toByteArray())); } I've attached the patched file for version 2.2.1
Hide
Permalink
Cheng Lee added a comment - 11/Nov/09 09:08 PM

Patched FtpMessageRequester.java for version 2.2.1

Show
Cheng Lee added a comment - 11/Nov/09 09:08 PM Patched FtpMessageRequester.java for version 2.2.1

People

  • Assignee:
    Daniel Zapata
    Reporter:
    David Borja
Vote (1)
Watch (1)

Dates

  • Created:
    20/Oct/08 05:37 PM
    Updated:
    04/Dec/09 11:45 AM

Agile

  • View on Board
  • Atlassian JIRA (v5.0.7#734-sha1:8ad78a6)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for MuleForge. Try JIRA - bug tracking software for your team.