0

I work with Mule. And I have spring bean

<spring:bean id="`MyPropertiesSaver`" name="MyPropertiesSaver" class="MyPropertiesSaver">
        <spring:property name="prop_name" value="${PROP_VALUE}"/>
    </spring:bean>

Also I work with file in flow

<flow name="Handler" doc:name="Handler">
    <file:inbound-endpoint `path="${PROP_VALUE}"` moveToPattern="#[header:originalFilename].txt" responseTimeout="10000" doc:name="File"/>
    ...
</flow>

So I get PROP_VALUE from system variables. I want to change path of file while programm is running. I change prop_name of class MyPropertiesSaver using MX4J. But path="${PROP_VALUE}" does not change. That's why I want to get prop_name from MyPropertiesSaver. Somthing like this

path="MyPropertiesSaver.prop_name"

How can I do that?

RuF
  • 548
  • 1
  • 11
  • 31

2 Answers2

1

Having a Dynamic Endpoint for File Inbound is not possible. File Inbound should know where to look for when the flow is started.

If your usecase demands a dynamic file location and reading you can try the workaround with Mule Requester module.

Read throubh the following link for more details.

Unable to create dynamic file inbound endpoint in mule

Hope this helps.

Community
  • 1
  • 1
user1760178
  • 6,277
  • 5
  • 27
  • 57
  • Since we're using a spring property here, the value is available when the flow is started. – Ryan Hoegg Dec 16 '14 at 20:35
  • I see that the OP wants to change the path after the flow is started, so subsequent changes to this property would require a dynamic value. Using the requester module is probably your best bet. – Ryan Hoegg Dec 16 '14 at 20:41
1

You need to extend the file message receiver to allow to externally set of the fileDir and disconnect-connect when this happens. Then in your connector use a service-override to use that customised message receiver.

Víctor Romero
  • 5,107
  • 2
  • 22
  • 32
  • I overrided `basicListFiles(readDirectory, discoveredFiles)`. Now instead of `readDirectory` I use my own path what I can change. – RuF Dec 17 '14 at 10:52