mule read single file from classpath during flow

前端 未结 8 1741
渐次进展
渐次进展 2020-12-05 11:13

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 co

8条回答
  •  执念已碎
    2020-12-05 11:57

    For some reason I cannot make the solution proposed by David Dossot to work. I was inspired by this answer and came up with another solution

    
        
    
    

    and then you can use set-payload in the following way

    
    

    which will result in setting the payload with the content of the file as a String.

    This method has the advantage that the content of the resource file is loaded only once into a bean of type String. So if your set-payload statement is executed frequently, this could improve performance.

提交回复
热议问题