Unable to create dynamic input endpoint in mule

I get the file path as input in the mule inside xml. Using the XPATH expression, I can extract the path. I want to read a specific file from this path. I tried to determine the endpoint of the incoming file as shown below. But it does not seem to work.

    <flow name="flow1">
     ....
     ....
    <set-session-variable variableName="filePath" value="#[xpath://filePath]" />
    <flow-ref name="fileFlow"/>
    </flow>

    <flow name="fileFlow">
    <file:inbound-endpoint path="#[header:SESSION:filePath]" />
    </flow>

My understanding here is that no code can be placed in front of an inbound-endpoint. Therefore, I defined it in another thread. Please indicate if there is a way to read the file at the specified path.

+3
source share
1 answer

Unfortunately, you cannot programmatically call an inbound-endpoint.

However, the same functionality can be achieved using the Mule request module:

Example:

  <flow name="RequestFile" doc:name="RequestFile">
        <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="requestfile" doc:name="HTTP"/>
        <mulerequester:request config-ref="Mule_Requester" resource="file:///s/tmp/demorequester/read/#[message.inboundProperties['filename']]" returnClass="java.lang.String" doc:name="Request a file"/>
    </flow>

: https://github.com/mulesoft/mule-module-requester https://blogs.mulesoft.com/dev/mule-dev/introducing-the-mule-requester-module/

+4

All Articles