简体   繁体   中英

AWS Simple Workflow - respondDecisionTaskCompleted Not Working?

I am currently using the PHP SDK for SWF. I successfully pull decision tasks using:

$result = $client->pollForDecisionTask(array(
    "domain" => "test",
    "taskList" => array(
        "name" => "mainTaskList"
    ),
    "identify" => "default",
    "maximumPageSize" => 50,
    "reverseOrder" => true
));

$activity_type_version = "1.0";

$task_token = $result["taskToken"];
$run_id = $result["workflowExecution"]["runId"];
$last_event = $result["events"][0]["eventId"];

if($last_event == "3"){
    $activity_type_name = "SlamStart";
}

I then try to register my completed decision task with the following:

$result = $client->respondDecisionTaskCompleted(array(
    "taskToken" => $task_token,
    "decisions" => array(
        "decisionType" => "ScheduleActivityTask",
        "scheduleActivityTaskDecisionAttributes" => array(
            "activityType" => array(
                "name" => $activity_type_name,
                "version" => $activity_type_version
            ),
            "activityId" => "1",
            "control" => "something",
            "scheduleToCloseTimeout" => "300",
            "scheduleToStartTimeout" => "300",
            "startToCloseTimeout" => "300",
            "heartbeatTimeout" => "300",
            "taskList" => array(
                "name" => "mainTaskList"
            ),
            "input" => "test input"
        )
    )
));

echo "respondDecisionTaskCompleted call went through";

The above never goes through and the last line with echo is never reached.

Why is this happening?

The decisions property has one array wrapped inside of a second array. Instead of

"decisions" => array(
    "decisionType" => "ScheduleActivityTask",
    "scheduleActivityTaskDecisionAttributes" => array(
        "activityType" => array(
            "name" => $activity_type_name,
            "version" => $activity_type_version
        ),
        "activityId" => "1",
        "control" => "something",
        "scheduleToCloseTimeout" => "300",
        "scheduleToStartTimeout" => "300",
        "startToCloseTimeout" => "300",
        "heartbeatTimeout" => "300",
        "taskList" => array(
            "name" => "mainTaskList"
        ),
        "input" => "test input"
    )
)

Had to change it to:

"decisions" => array(
    array(
        "decisionType" => "ScheduleActivityTask",
        "scheduleActivityTaskDecisionAttributes" => array(
            "activityType" => array(
                "name" => $activity_type_name,
                "version" => $activity_type_version
            ),
            "activityId" => "1",
            "control" => "something",
            "scheduleToCloseTimeout" => "300",
            "scheduleToStartTimeout" => "300",
            "startToCloseTimeout" => "300",
            "heartbeatTimeout" => "300",
            "taskList" => array(
                "name" => "mainTaskList"
            ),
            "input" => "test input"
        )
    )
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM