Question

I have a Mule flow which processes files in an inbound folder that are named AAA_[id_number].dat. However, I need to configure Mule to only process this file when a corresponding file named [id_number].dat is also available. The second file indicates that the first is ready for processing.

Is there a way I can configure an inbound endpoint in Mule to only start processing the AAA_ file when it's counterpart is present? The [id_number].dat file is purely for notification purposes, it should not be processed by Mule. The inbound endpoint has a regex filter to look for a file in the format AAA...

<!-- Mule Requester Config -->
<mulerequester:config name="muleRequesterConfig" doc:name="Mule Requester"/>

<!-- File Connectors -->
<file:connector name="inputTriggerConnector" pollingFrequency="100" doc:name="File"/>
<file:connector name="inputFileConnector" doc:name="File"/>
<file:connector name="outputFileConnector" doc:name="File"/>

<!-- File Endpoints -->
<file:endpoint name="inputFileEndpoint" path="src/test/input" responseTimeout="10000" doc:name="File">
    <file:filename-regex-filter pattern="\d{6}.dat" caseSensitive="true"/>  
</file:endpoint>

<!-- Trigger Flow -->
<flow name="triggerFlow" doc:name="triggerFlow">

    <file:inbound-endpoint ref="inputFileEndpoint" connector-ref="inputTriggerConnector" pollingFrequency="1000" doc:name="Input Trigger"/>

    <flow-ref name="mainFlow_StockB2C" doc:name="Flow Reference"/>       

</flow>

<!-- Main Flow -->
<flow name="mainFlow" doc:name="mainFlow">

    <mulerequester:request config-ref="muleRequesterConfig" resource="file://.../AAA_#[message.inboundProperties.originalFilename]?connector=inputFileConnector" timeout="6000" doc:name="Mule Requester"/>

    <DO SOMETHING WITH AAA_ FILE>

    <file:outbound-endpoint connector-ref="outputFileConnector" path="src/test/output" outputPattern="#[function:dateStamp].csv" responseTimeout="6000" doc:name="Output File"/>

</flow>
Était-ce utile?

La solution

Why not filter set a file inbound filter for the [id_number].dat files (or one that excludes the AAA_ files), if those are only used for notification? Would make more sense in my opinion. You can then grab the file to be processed with the requester module inside the flow, based on the originalFileName property.

Autres conseils

Just in case this might help someone who needs it, you can create a custom filter and include your own filtering logic in there. More details from this blog here

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top