I am trying to fetch the current task idI want to pass the it as a param to httprequest input param..I am trying to fetch something like ${TaskName.taskId}. But this value is coming null.Can you suggest is there any way to get this value?
The schemaVersion of the Workflow should be '2', it defaults to 1. It has to be explicitly set as '2'. I could pass the taskId of a SIMPLE task to a HTTPTask. Refer to the below sample Workflow JSON:
{
"createTime": 1499950349994,
"name": "WF",
"version": 3,
"tasks": [{
"name": "task1",
"taskReferenceName": "task1",
"inputParameters": {
"inputKey1": "${workflow.input.inputKey1}"
},
"type": "SIMPLE",
"startDelay": 0
},
{
"name": "getPost",
"taskReferenceName": "getPost",
"inputParameters": {
"http_request": {
"taskId": "${task1.taskId}",
"method": "GET",
"uri": "<sampleurl>",
"contentType": "application/json"
}
},
"type": "HTTP",
"startDelay": 0
}
],
"schemaVersion": 2
}
This one worked with Conductor 1.8.0-SNAPSHOT
Closing the issue. You should set the schemaVersion to 2 to fix the issue.
Is there a way we can get the currentTask TaskId in the HTTPTask?
If I try to get the taskId similar with @smkb80 comment, I got null for the taskId.
Example:
{
"createTime": 1499950349994,
"name": "WF",
"version": 3,
"tasks": [
{
"name": "getPost",
"taskReferenceName": "getPost",
"inputParameters": {
"http_request": {
"taskId": "${getPost.taskId}",
"method": "GET",
"uri": "
"contentType": "application/json"
}
},
"type": "HTTP",
"startDelay": 0
}
],
"schemaVersion": 2
}
FYI for everyone who needs this.
Use ${CPEWF_TASK_ID} variable.
Some task examples:
{
"name": "event_task",
"taskReferenceName": "event_0",
"inputParameters": {
"taskId": "${CPEWF_TASK_ID}",
"mod": "${workflow.input.mod}",
"oddEven": "${workflow.input.oddEven}"
},
"type": "EVENT",
"sink": "conductor"
},
{
"name": "search_elasticsearch",
"taskReferenceName": "get_es",
"inputParameters": {
"http_request": {
"uri": "http://localhost:9200/${CPEWF_TASK_ID}",
"method": "GET",
"body" : {
"taskId": "${CPEWF_TASK_ID}"
}
}
},
"type": "HTTP"
}
Most helpful comment
The schemaVersion of the Workflow should be '2', it defaults to 1. It has to be explicitly set as '2'. I could pass the taskId of a SIMPLE task to a HTTPTask. Refer to the below sample Workflow JSON:
This one worked with Conductor 1.8.0-SNAPSHOT