I'm writing out some messages to oozie.action.output.properties
file in java action called through oozie workflow. That message is retrieved in next workflow using ${wf:actionData('<action>')['<messageKey>']}
. But, sometimes I need not write any message to properties file. In such case, oozie gives error message when retrieving the message as variable [<messageKey>] cannot be resolved
.
If it returns null or empty, I can continue with the workflow but if fails with the mentioned error. or How can I verify if that variable exists or no message exists for that messageKey.
Example snippet:
<action name="fail-check">
<sub-workflow>
<app-path>${wf:appPath()}/../fail-check</app-path>
<propagate-configuration />
<configuration>
<property>
<name>dataPrepSetupMsg</name>
<value>${wf:actionData('setup')['errMsg']}</value>
Inside JAVA action:
if(message != null){
final String filePath = System.getProperty("oozie.action.output.properties");
properties.put(errorMessage, message);
OutputStream outputStream = new FileOutputStream(filePath);
properties.store(outputStream, null);
}