1

Using Mule 3, how can I pass a java.io.File object payload from an inbound file endpoint to a Groovy script rather than the file's content?

David Dossot
  • 33,403
  • 4
  • 38
  • 72
Matt
  • 526
  • 6
  • 19

1 Answers1

4

You need to turn streaming off and override the default message factory on the file connector:

<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.

David Dossot
  • 33,403
  • 4
  • 38
  • 72
  • In the case above, i can use the file:outbound-endpoint normally to move the file after i'm done processing it? – jonfornari Sep 27 '13 at 19:29
  • Not sure how you would do that, ie moving a file with an outbound endpoint? – David Dossot Sep 27 '13 at 20:34
  • 1
    Forget that, my mistake. I tought that the file outbound endpoint would move the original file (inbound) but it actually saves the payload content in a new file. – jonfornari Oct 04 '13 at 04:47
  • David, can you please help me on this.? http://stackoverflow.com/questions/20657425/mule-how-to-pass-file-from-ftp-to-java-class-in-mule-esb – Rizwan Sohaib Dec 18 '13 at 12:21