|
对于最新稳定版本,请使用Spring Boot 4.0.0! |
定时任务(计划任务)
这计划任务端点提供关于应用程序调度任务的信息。
检索预定任务
要检索排程任务,请设置获取请求/执行器/调度任务如以下基于卷度的示例所示:
$ curl 'http://localhost:8080/actuator/scheduledtasks' -i -X GET
最终的响应类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 629
{
"cron" : [ {
"runnable" : {
"target" : "com.example.Processor.processOrders"
},
"expression" : "0 0 0/3 1/1 * ?"
} ],
"fixedDelay" : [ {
"runnable" : {
"target" : "com.example.Processor.purge"
},
"initialDelay" : 5000,
"interval" : 5000
} ],
"fixedRate" : [ {
"runnable" : {
"target" : "com.example.Processor.retrieveIssues"
},
"initialDelay" : 10000,
"interval" : 3000
} ],
"custom" : [ {
"runnable" : {
"target" : "com.example.Processor$CustomTriggeredRunnable"
},
"trigger" : "com.example.Processor$CustomTrigger@6a670dcc"
} ]
}
响应结构
响应包含应用程序调度任务的详细信息。 下表描述了该反应的结构:
| 路径 | 类型 | 描述 |
|---|---|---|
|
|
如果有克朗任务的话。 |
|
|
目标将被执行。 |
|
|
克朗表情。 |
|
|
如果有固定延迟任务的话。 |
|
|
目标将被执行。 |
|
|
延迟,按毫秒计,在首次执行前。 |
|
|
间隔,以毫秒计,介于上一次执行结束与下一次执行开始之间。 |
|
|
如果有固定费率的任务。 |
|
|
目标将被执行。 |
|
|
每次执行开始之间的间隔,以毫秒计。 |
|
|
延迟,按毫秒计,在首次执行前。 |
|
|
如果有自定义触发器的任务。 |
|
|
目标将被执行。 |
|
|
任务的触发点。 |