mule read single file from classpath during flow

Jeff picture Jeff · Nov 2, 2012 · Viewed 19.7k times · Source

Is there an easy way to configure a Flow to read a single file from the classpath one time? I don't need to poll for a file. I just need to read a known file and set its contents as the message payload.

Answer

David Dossot picture David Dossot · Nov 2, 2012

Use the set-payload message processor and a MEL expression:

<set-payload value="#[Thread.currentThread().getContextClassLoader().getResourceAsStream('my-file.abc')]" />