问题描述
我在工作流程中有2个动作节点:javaMainAction
和javaMainAction2
.
I have 2 action nodes in workflow : javaMainAction
and javaMainAction2
.
我的LoadApplicationService
方法执行后返回SUCCESS或FAILURE.
My LoadApplicationService
method returns SUCCESS or FAILURE after execution.
如何检查是否返回SUCCESS的响应?
How to check response if SUCCESS is returned?
workflow.xml:
workflow.xml :
<workflow-app name="WorkflowJavaMainAction" xmlns="uri:oozie:workflow:0.1">
<start to="javaMainAction" />
<action name="javaMainAction">
<java>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<main-class>in.augmentiq.maxiq.dataschedular.services.LoadApplicationService</main-class>
<arg>${workflowAppPath}/javaMainActionInput/schedule_config.properties</arg>
<arg>${workflowAppPath}/javaMainActionInput/appRequestParams.json</arg>
<capture-output/>
</java>
<ok to="javaMainAction2" />
<error to="killJobAction" />
</action>
<action name="javaMainAction2">
<java>
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<main-class>in.augmentiq.maxiq.dataschedular.services.LoadApplicationService</main-class>
<arg>${workflowAppPath}/javaMainAction2Input/schedule_config.properties</arg>
<arg>${workflowAppPath}/javaMainAction2Input/appRequestParams.json</arg>
<capture-output/>
</java>
<ok to="end" />
<error to="killJobAction" />
</action>
<kill name="killJobAction">
<message>"Killed job due to error: ${wf:errorMessage(wf:lastErrorNode())}"</message>
</kill>
<end name="end" />
</workflow-app>
推荐答案
LoadApplicationService
需要将输出写入key=pair
格式,例如response=SUCCESS
.您可以检查输出,如下所示:
LoadApplicationService
needs to write the output into a key=pair
format e.g. response=SUCCESS
. The you can inspect the output like this:
${wf:actionData("action-name")["key"]}
使用决策控制"节点比较并做出决策 Decision_Control_Node .
Use Decision control node for comparing and taking decision Decision_Control_Node.
main()方法将属性文件写入oozie.action.output.properties
ENVIRONMENT变量中指定的路径. 参考
The main() method writes a Property file to the path specified in the oozie.action.output.properties
ENVIRONMENT variable. Reference
public static void main (String[] args)
{
String fileName = args[0];
try{
File file = new File(System.getProperty("oozie.action.output.properties"));
Properties props = new Properties();
props.setProperty("PASS_ME", "123456");
OutputStream os = new FileOutputStream(file);
props.store(os, "");
os.close();
System.out.println(file.getAbsolutePath());
}
catch (Exception e) {
e.printStackTrace();
}
}
这篇关于如何检查LoadApplicationService的完成状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!