计划任务 (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.