Reputation: 315
I have 2 flows that process nodes.flow and relationships.flow and eventually both the flows write to a Database.
Nodes and Relationships are read from separate tsv files and read through fileconnector endpoint
I want to synchronize the flows so that nodes.tsv should always get processed before relationships.tsv. Something like this:
any ideas?
thanks
Upvotes: 2
Views: 366
Reputation: 33413
Reading your specs, the only file inbound endpoint you need is one that waits for the nodes.tsv file.
When this file is picked-up, process it as expected.
Then, further in the flow, use:
<scripting:component>
<scripting:script engine="groovy"><![CDATA[
muleContext.client.request('file:///....../relationships.tsv', eventContext.timeout)
]]></scripting:script>
</scripting:component>
<message-filter throwOnUnaccepted="false">
<not-filter>
<payload-type-filter expectedType="org.mule.transport.NullPayload" />
</not-filter>
</message-filter>
to pick-up the relationships file. If it doesn't exist, the filter will stop the flow there. If it exists, then what's after in the flow will be able to process it.
Upvotes: 1
Reputation: 7551
By default the file endpoints will process when a file appears in the target dir, so I would dispense with one of the endpoints and in your master one just pull the slave file in like so:
muleClient.request('file://D:/foo/in', -1);
Alternatively have a file name filter on the slave flow and then have your master flow rename the files in the slave dir to match the file filter.
Upvotes: 1