計劃任務 (scheduledtasks)

scheduledtasks 端點提供有關應用程式計劃任務的資訊。

檢索計劃任務

要檢索計劃任務,請向 /actuator/scheduledtasks 傳送 GET 請求,如以下基於 curl 的示例所示

$ curl 'https://:8080/actuator/scheduledtasks' -i -X GET

結果響應類似於以下內容

HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 1222

{
  "cron" : [ {
    "expression" : "0 0 0/3 1/1 * ?",
    "nextExecution" : {
      "time" : "2025-11-20T17:59:59.999073346Z"
    },
    "runnable" : {
      "target" : "com.example.Processor.processOrders"
    }
  } ],
  "custom" : [ {
    "lastExecution" : {
      "exception" : {
        "message" : "Failed while running custom task",
        "type" : "java.lang.IllegalStateException"
      },
      "status" : "ERROR",
      "time" : "2025-11-20T16:33:59.854299429Z"
    },
    "runnable" : {
      "target" : "com.example.Processor$CustomTriggeredRunnable@7cc19564"
    },
    "trigger" : "com.example.Processor$CustomTrigger@3cd39478"
  } ],
  "fixedDelay" : [ {
    "initialDelay" : 0,
    "interval" : 5000,
    "lastExecution" : {
      "status" : "SUCCESS",
      "time" : "2025-11-20T16:33:59.818361640Z"
    },
    "nextExecution" : {
      "time" : "2025-11-20T16:34:04.825810594Z"
    },
    "runnable" : {
      "target" : "com.example.Processor.purge"
    }
  } ],
  "fixedRate" : [ {
    "initialDelay" : 10000,
    "interval" : 3000,
    "nextExecution" : {
      "time" : "2025-11-20T16:34:09.804341635Z"
    },
    "runnable" : {
      "target" : "com.example.Processor.retrieveIssues"
    }
  } ]
}

響應結構

響應包含應用程式計劃任務的詳細資訊。下表描述了響應的結構

路徑 型別 描述

cron

陣列

Cron 任務(如果有)。

cron.[].runnable.target

字串

將被執行的目標。

cron.[].nextExecution.time

字串

下一次計劃執行的時間。

cron.[].expression

字串

Cron 表示式。

fixedDelay

陣列

固定延遲任務(如果有)。

fixedDelay.[].runnable.target

字串

將被執行的目標。

fixedDelay.[].initialDelay

數字

首次執行前的延遲(毫秒)。

fixedDelay.[].nextExecution.time

字串

下一次計劃執行的時間(如果已知)。

fixedDelay.[].interval

數字

上次執行結束與下次執行開始之間的間隔(毫秒)。

fixedRate

陣列

固定頻率任務(如果有)。

fixedRate.[].runnable.target

字串

將被執行的目標。

fixedRate.[].interval

數字

每次執行開始之間的間隔(毫秒)。

fixedRate.[].initialDelay

數字

首次執行前的延遲(毫秒)。

fixedRate.[].nextExecution.time

字串

下一次計劃執行的時間(如果已知)。

custom

陣列

具有自定義觸發器的任務(如果有)。

custom.[].runnable.target

字串

將被執行的目標。

custom.[].trigger

字串

任務的觸發器。

*.[].lastExecution

物件

此任務的上次執行(如果有)。

*.[].lastExecution.status

字串

上次執行的狀態 (STARTED, SUCCESS, ERROR)。

*.[].lastExecution.time

字串

上次執行的時間。

*.[].lastExecution.exception.type

字串

任務丟擲的異常型別(如果有)。

*.[].lastExecution.exception.message

字串

任務丟擲的異常訊息(如果有)。

© . This site is unofficial and not affiliated with VMware.