I want to use choice flow control which will chose one route when file named #[function:dateStamp:dd-MM-yyyy].xml exists and other route when this file does not exist.
Is it possible to write 'when' part of choice to check for file existence?
You could use MEL:
<configuration>
<expression-language>
<import class="java.text.SimpleDateFormat" />
<global-functions><![CDATA[
def xmlFileExists() {
filePath = '/tmp/' + new SimpleDateFormat('dd-MM-yyyy').format(new Date()) + '.xml';
new File(filePath).isFile();
}
]]></global-functions>
</expression-language>
</configuration>
...
<choice>
<when expression="#[xmlFileExists()]">
...
</when>
<otherwise>
...
</otherwise>
</choice>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With