简体   繁体   中英

Mule - Dynamic file inbound endpoint error

My ESB flow needs to get files from a dynamic folder. This folder name changes based on month and year. Hence, I configured my inbound-endpoint as shown below but I am getting below error. I really appreciate any help on this.

Flow:

<flow name="DataMapperTestFlow" doc:name="DataMapperTestFlow">
    <file:inbound-endpoint path="C:\#[new Date().format('yyyy\\MMMM')]" moveToDirectory="C:\#[new Date().format('yyyy\\MMMM')]\backup" pollingFrequency="10000" responseTimeout="10000" doc:name="File">
        <file:filename-regex-filter pattern=".*.xls" caseSensitive="true"/>
    </file:inbound-endpoint>
    <custom-transformer class="ExcelToJava" doc:name="Java"/>
    <jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="insertTestHeaders" connector-ref="NewDatabase" doc:name="InsertHeaders"/>
    <set-payload value="#[payload.excelData.excelRows]" doc:name="Set Payload"/>
    <jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="insertTestRows" connector-ref="NewDatabase" doc:name="InsertRows"/>
</flow>

Error:

org.mule.api.endpoint.MalformedEndpointException: The endpoint "file:///C:/#[new Date().format('yyyy/MMMM')]" is malformed and cannot be parsed. If this is the name of a global endpoint, check the name is correct, that the endpoint exists, and that you are using the correct configuration (eg the "ref" attribute). Note that names on inbound and outbound endpoints cannot be used to send or receive messages; use a named global endpoint instead.. Only Outbound endpoints can be dynamic

"Only Outbound endpoints can be dynamic" quite says it all. You can have a look at the Mule Requester Module if it suits your needs, or try creating endpoints/flows programmatically with a scheduler and Java/Groovy/etc code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM