设置Azure计划程序作业重试策略

时间:2014-10-20 19:34:58

标签: azure scheduler

使用Azure Management REST API,我尝试使用重试策略更新(PATCH)现有的Scheduler作业。请求被接受,但json响应对象不包括重试策略条目。

如果是更新,我所做的其他更改会反映在响应中。

Azure Scheduler作业实体结构:http://msdn.microsoft.com/library/azure/dn528941.aspx

Azure Scheduler REST API ref:http://msdn.microsoft.com/en-us/library/azure/dn528946.aspx

我正在使用Burp Suite快速迭代不同的请求,但我从未看到任何建议重试策略的建议。

我错过了什么?

以下请求将创建一个新的作业名称SampleJob20(没有重试策略)

PUT /<subid>/cloudservices/<cloudservicename>/resources/scheduler/~/JobCollections/<jobcollectionname>/jobs/SampleJob20?api-version=2014-04-01 HTTP/1.1
Content-Type: application/json
x-ms-version: 2012-03-01
Host: management.core.windows.net
Content-Length: 583



{
    "startTime": "2013-01-30T12:08:00-08:00",
    "action":
    {
        "type": "http",
        "request":
        {
            "uri": "http://bing.com/",
            "method": "GET",
            "headers": 
            {
                "Content-Type": "text/plain"
            }
        }
    },
    "recurrence":
    {
        "frequency": "minute",
        "interval": 30,
        "count": 1000
    },
    "state": "enabled"
}

此请求的响应是:

HTTP/1.1 201 Created
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 364
Content-Type: application/json; charset=utf-8
Expires: -1
Server: 1.0.6198.148 (rd_rdfe_stable.141019-1428) Microsoft-HTTPAPI/2.0
x-ms-servedbyregion: ussouth2
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
x-ms-request-id: xxxxxxxxxxxxxxxxx
Date: Mon, 20 Oct 2014 19:13:40 GMT

{
    "id":"SampleJob20",
    "startTime":"2013-01-30T20:08:00Z",
    "action":
    {
        "request":
        {
            "uri":"http:\/\/bing.com\/","method":"GET",
            "headers":
            {
                "content-Type":"text\/plain"
            }
        },
        "type":"http"
    },
    "recurrence":
    {
        "frequency":"minute",
        "count":1000,
        "interval":30
    },
    "state":"enabled",
    "status":
    {
        "nextExecutionTime":"2014-10-20T19:38:00Z",
        "executionCount":0,
        "failureCount":0,
        "faultedCount":0
    }
}

当我尝试使用重试策略更新此作业时。响应缺少重试策略详细信息。

PATCH /<subid>/cloudservices/<cloudservicename>/resources/scheduler/~/JobCollections/<jobcollectionname>/jobs/SampleJob20?api-version=2014-04-01 HTTP/1.1
Content-Type: application/json
x-ms-version: 2012-03-01
Host: management.core.windows.net
Content-Length: 451



{
    "id": "SampleJob20",
    "action":
        {
            "type": "http",
            "request":
            {
                    "uri": "http://bing.com",
                    "method": "GET",
                    "headers": 
                    {
                        "Content-Type": "text/plain"
                    }
            },

            "retryPolicy": 
            {
                "retryType":"fixed",
                "retryInterval": "PT1M",
                "retryCount": 3
            }
        }
}

如果我使用重试策略创建新作业,则响应包含重试详细信息。但是,无法更新作业重试策略。

1 个答案:

答案 0 :(得分:0)

你能尝试这样的新工作或同一工作(它包括Put请求中的重试策略)

PUT

{
"startTime": "2013-01-30T12:08:00-08:00",
"action":
{
    "type": "http",
    "request":
    {
        "uri": "http://bing.com/",
        "method": "GET",
        "headers": 
        {
            "Content-Type": "text/plain"
        }
    },
       "retryPolicy": 
        {
            "retryType":"fixed",
            "retryInterval": "PT1M",
            "retryCount": 3
        }
},
"recurrence":
{
    "frequency": "minute",
    "interval": 30,
    "count": 1000
},
"state": "enabled"
}