我怀疑在 oozie 的当前状态下使用 oozie.wf.workflow.notification.url 可以做到这一点。我检查了oozie source code 并发现了这个:
org.apache.oozie.client.OozieClient(在常量中读取属性):
public static final String WORKFLOW_NOTIFICATION_URL = "oozie.wf.workflow.notification.url";
org.apache.oozie.command.wf.WorkflowNotificationXCommand(该常量用于构成proxyConf变量):
public WorkflowNotificationXCommand(WorkflowJobBean workflow) {
super("job.notification", "job.notification", 0);
ParamChecker.notNull(workflow, "workflow");
jobId = workflow.getId();
url = workflow.getWorkflowInstance().getConf().get(OozieClient.WORKFLOW_NOTIFICATION_URL);
if (url != null) {
url = url.replaceAll(JOB_ID_PATTERN, workflow.getId());
url = url.replaceAll(STATUS_PATTERN, workflow.getStatus().toString());
proxyConf = workflow.getWorkflowInstance().getConf()
.get(OozieClient.WORKFLOW_NOTIFICATION_PROXY, ConfigurationService.get(NOTIFICATION_PROXY_KEY));
LOG.debug("Proxy :" + proxyConf);
}
}
org.apache.oozie.command.NotificationXCommand(使用 proxyConf 变量在 WorkflowNotificationXCommand 的超类中调用自身):
protected void sendNotification() {
if (url != null) {
Proxy proxy = getProxy(proxyConf);
try {
URL url = new URL(this.url);
HttpURLConnection urlConn = (HttpURLConnection) url.openConnection(proxy);
urlConn.setConnectTimeout(getTimeOut());
urlConn.setReadTimeout(getTimeOut());
if (urlConn.getResponseCode() != HttpURLConnection.HTTP_OK) {
handleRetry();
}
}
catch (IOException ex) {
handleRetry();
}
}
else {
LOG.info("No Notification URL is defined. Therefore nothing to notify for job " + jobId);
}
}
如您所见,此处没有使用httpURLConnection.setRequestProperty(,) 设置标题。
您可以使用自定义 java 操作来解决问题,您可以使用任何您喜欢的标头从中进行 http 调用。