Spring XD Rest api job launch with jobParameters responding with 'jobParameters' is not recognized as an internal or external command

人走茶凉 提交于 2019-12-12 01:24:41

问题


I have Spring XD job already deployed which expects 2 jobParameters (absoluteFilePath and fileName). Actually this job is triggered by JMS stream whose output provides those 2 jobParameters in JSON format and that works fine. I want to launch the job with REST API like:

curl -X POST   http://localhost:9393/jobs/executions?jobname=loadData&jobParameters=%7B%22absoluteFilePath%22%3A%22C%3A%2FUB%2Fdev%2FBM.txt%22%2C%22fileName%22%3A%22BM.txt%22%7D

Error I'm getting: 'jobParameters' is not recognized as an internal or external command, operable program or batch file.

Wondering if there is anything wrong with CURL command or if jobParameters is not supported?

I'm able to launch a job without jobParameters with the following CURL command, but as the job expects parameters it fails.

curl -X POST   http://localhost:9393/jobs/executions?jobname=loadData

回答1:


Have you tried launching via the XD shell? It sends the jobName and jobParameters in the request body...

public void launchJob(String name, String jobParameters) {
    String uriTemplate = resources.get("jobs/executions").toString();
    MultiValueMap<String, Object> values = new LinkedMultiValueMap<String, Object>();
    values.add("jobParameters", jobParameters);
    values.add("jobname", name);
    restTemplate.postForObject(uriTemplate, values, Object.class);
}

This looks like an OS shell message; try adding '...' around the URL.

Google makes me think this is on Windows (not sure where you're getting curl from); for Windows, you'll probably need "...".

(The problem is the &).



来源:https://stackoverflow.com/questions/29971057/spring-xd-rest-api-job-launch-with-jobparameters-responding-with-jobparameters

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!