2

In a flow something like below:

<flow name="fileFlow">
    <file:inbound-endpoint path="/inbound/ftp/sbc" pollingFrequency="30000" fileAge="30000" moveToDirectory="/inbound/ftp/sbc/archive">
        <file:filename-wildcard-filter pattern="*.xml" caseSensitive="false"/>
    </file:inbound-endpoint>
    <logger message="Entering #[flow.name] flow" level="INFO"/>
    <component class="com.abc.RequestFile"/>
    <logger message="Payload after transformation is: #[payload] flow" level="INFO"/>
     <vm:outbound-endpoint path="merge" />  
    <logger message="Exiting #[flow.name] flow" level="INFO"/>
</flow>

I get InputStream from file:inbound-endpoint which is passed to RequestFile component. This component is required to return a list of files of which one of this is the original one read and passed. I am seeking a solution other than manual copying InputStream to File in java component.

David Dossot
  • 33,403
  • 4
  • 38
  • 72
Charu Khurana
  • 4,511
  • 8
  • 47
  • 81

1 Answers1

6

As explained in this answer https://stackoverflow.com/a/12397775/387927 you can get the java.io.File object instead of its content with this setting:

<file:connector name="fileConnector" streaming="false" autoDelete="false">
    <service-overrides messageFactory="org.mule.transport.file.FileMuleMessageFactory" />
</file:connector>

Note that it is up to you to move / delete the file either before you start or once you've done processing it, otherwise Mule will poll it again and again.

Community
  • 1
  • 1
David Dossot
  • 33,403
  • 4
  • 38
  • 72