Quartz (quartz
)
quartz
端点提供有关由 Quartz Scheduler 管理的作业和触发器的信息。
获取已注册的组
作业和触发器在组中进行管理。
要获取已注册的作业和触发器组列表,向 /actuator/quartz
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz' -i -X GET
响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 120
{
"jobs" : {
"groups" : [ "samples", "tests" ]
},
"triggers" : {
"groups" : [ "samples", "DEFAULT" ]
}
}
获取已注册的作业名称
要获取已注册的作业名称列表,向 /actuator/quartz/jobs
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz/jobs' -i -X GET
响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 137
{
"groups" : {
"samples" : {
"jobs" : [ "jobOne", "jobTwo" ]
},
"tests" : {
"jobs" : [ "jobThree" ]
}
}
}
获取已注册的触发器名称
要获取已注册的触发器名称列表,向 /actuator/quartz/triggers
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz/triggers' -i -X GET
响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 229
{
"groups" : {
"samples" : {
"paused" : false,
"triggers" : [ "3am-weekdays", "every-day", "once-a-week" ]
},
"DEFAULT" : {
"paused" : false,
"triggers" : [ "every-hour-tue-thu" ]
}
}
}
获取作业组概览
要获取特定组中作业的概览,向 /actuator/quartz/jobs/{groupName}
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz/jobs/samples' -i -X GET
前面的示例获取 samples
组中作业的摘要。
响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 201
{
"group" : "samples",
"jobs" : {
"jobOne" : {
"className" : "org.springframework.scheduling.quartz.DelegatingJob"
},
"jobTwo" : {
"className" : "org.quartz.Job"
}
}
}
获取触发器组概览
要获取特定组中触发器的概览,向 /actuator/quartz/triggers/{groupName}
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz/triggers/tests' -i -X GET
前面的示例获取 tests
组中触发器的摘要。
响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 1274
{
"group" : "tests",
"paused" : false,
"triggers" : {
"cron" : {
"3am-week" : {
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 3,
"expression" : "0 0 3 ? * 1,2,3,4,5",
"timeZone" : "Europe/Paris"
}
},
"simple" : {
"every-day" : {
"nextFireTime" : "2020-12-04T12:00:00.000+00:00",
"priority" : 7,
"interval" : 86400000
}
},
"dailyTimeInterval" : {
"tue-thu" : {
"priority" : 5,
"interval" : 3600000,
"daysOfWeek" : [ 3, 5 ],
"startTimeOfDay" : "09:00:00",
"endTimeOfDay" : "18:00:00"
}
},
"calendarInterval" : {
"once-a-week" : {
"previousFireTime" : "2020-12-02T14:00:00.000+00:00",
"nextFireTime" : "2020-12-08T14:00:00.000+00:00",
"priority" : 5,
"interval" : 604800000,
"timeZone" : "Asia/Shanghai"
}
},
"custom" : {
"once-a-year-custom" : {
"previousFireTime" : "2020-07-14T16:00:00.000+00:00",
"nextFireTime" : "2021-07-14T16:00:00.000+00:00",
"priority" : 10,
"trigger" : "com.example.CustomTrigger@fdsfsd"
}
}
}
}
响应结构
响应包含特定组中触发器的概览。 可获取触发器实现特定的详细信息。 下表描述了响应的结构:
Path | Type | Description |
---|---|---|
|
|
Name of the group. |
|
|
Whether the group is paused. |
|
|
Cron triggers keyed by name, if any. |
|
|
Simple triggers keyed by name, if any. |
|
|
Daily time interval triggers keyed by name, if any. |
|
|
Calendar interval triggers keyed by name, if any. |
|
|
Any other triggers keyed by name, if any. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
|
|
Cron expression to use. |
|
|
Time zone for which the expression will be resolved, if any. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
|
|
Interval, in milliseconds, between two executions. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
|
|
Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat. |
|
|
An array of days of the week upon which to fire. |
|
|
Time of day to start firing at the given interval, if any. |
|
|
Time of day to complete firing at the given interval, if any. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
|
|
Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat. |
|
|
Time zone within which time calculations will be performed, if any. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
|
|
A toString representation of the custom trigger instance. |
获取作业详情
要获取特定作业的详细信息,向 /actuator/quartz/jobs/{groupName}/{jobName}
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz/jobs/samples/jobOne' -i -X GET
前面的示例获取由 samples
组和 jobOne
名称标识的作业的详细信息。
响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 609
{
"group" : "samples",
"name" : "jobOne",
"description" : "A sample job",
"className" : "org.springframework.scheduling.quartz.DelegatingJob",
"durable" : false,
"requestRecovery" : false,
"data" : {
"password" : "secret",
"user" : "admin"
},
"triggers" : [ {
"group" : "samples",
"name" : "every-day",
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-04T12:00:00.000+00:00",
"priority" : 7
}, {
"group" : "samples",
"name" : "3am-weekdays",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 3
} ]
}
如果数据映射中的键被标识为敏感信息,其值将被清理。
响应结构
响应包含作业的完整详细信息,包括与之关联的触发器的摘要(如果有)。 触发器按下次触发时间和优先级排序。 下表描述了响应的结构:
Path | Type | Description |
---|---|---|
|
|
Name of the group. |
|
|
Name of the job. |
|
|
Description of the job, if any. |
|
|
Fully qualified name of the job implementation. |
|
|
Whether the job should remain stored after it is orphaned. |
|
|
Whether the job should be re-executed if a 'recovery' or 'fail-over' situation is encountered. |
|
|
Job data map as key/value pairs, if any. |
|
|
An array of triggers associated to the job, if any. |
|
|
Name of the trigger group. |
|
|
Name of the trigger. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
获取触发器详情
要获取特定触发器的详细信息,向 /actuator/quartz/triggers/{groupName}/{triggerName}
发送 GET
请求,如下面的基于 curl 的示例所示:
$ curl 'http://localhost:8080/actuator/quartz/triggers/samples/example' -i -X GET
前面的示例获取由 samples
组和 example
名称标识的触发器的详细信息。
通用响应结构
响应具有通用结构和特定于触发器类型的附加对象。 支持五种类型:
-
cron
用于CronTrigger
-
simple
用于SimpleTrigger
-
dailyTimeInterval
用于DailyTimeIntervalTrigger
-
calendarInterval
用于CalendarIntervalTrigger
-
custom
用于任何其他触发器实现
下表描述了响应中通用元素的结构:
Path | Type | Description |
---|---|---|
|
|
Name of the group. |
|
|
Name of the trigger. |
|
|
Description of the trigger, if any. |
|
|
State of the trigger ( |
|
|
Type of the trigger ( |
|
|
Name of the Calendar associated with this Trigger, if any. |
|
|
Time at which the Trigger should take effect, if any. |
|
|
Time at which the Trigger should quit repeating, regardless of any remaining repeats, if any. |
|
|
Last time the trigger fired, if any. |
|
|
Next time at which the Trigger is scheduled to fire, if any. |
|
|
Priority to use if two triggers have the same scheduled fire time. |
|
|
Last time at which the Trigger will fire, if any. |
|
|
Job data map keyed by name, if any. |
|
|
Calendar time interval trigger details, if any. Present when |
|
|
Custom trigger details, if any. Present when |
|
|
Cron trigger details, if any. Present when |
|
|
Daily time interval trigger details, if any. Present when |
|
|
Simple trigger details, if any. Present when |
Cron 触发器响应结构
cron 触发器定义了用于确定何时触发的 cron 表达式。 此类触发器实现的响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 490
{
"group" : "samples",
"name" : "example",
"description" : "Example trigger",
"state" : "NORMAL",
"type" : "cron",
"calendarName" : "bankHolidays",
"startTime" : "2020-11-30T17:00:00.000+00:00",
"endTime" : "2020-12-30T03:00:00.000+00:00",
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 3,
"data" : { },
"cron" : {
"expression" : "0 0 3 ? * 1,2,3,4,5",
"timeZone" : "Europe/Paris"
}
}
响应的很大一部分对所有触发器类型都是通用的。 响应中通用元素的结构已在 前面描述。 下表描述了响应中特定于 cron 触发器的部分的结构:
Path | Type | Description |
---|---|---|
|
|
Cron trigger specific details. |
|
|
Cron expression to use. |
|
|
Time zone for which the expression will be resolved, if any. |
Simple 触发器响应结构
simple 触发器用于在给定时间点触发作业,并可选择在指定间隔重复。 此类触发器实现的响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 549
{
"group" : "samples",
"name" : "example",
"description" : "Example trigger",
"state" : "NORMAL",
"type" : "simple",
"calendarName" : "bankHolidays",
"startTime" : "2020-11-30T17:00:00.000+00:00",
"endTime" : "2020-12-30T03:00:00.000+00:00",
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 7,
"finalFireTime" : "2020-12-29T17:00:00.000+00:00",
"data" : { },
"simple" : {
"interval" : 86400000,
"repeatCount" : -1,
"timesTriggered" : 0
}
}
响应的很大一部分对所有触发器类型都是通用的。 响应中通用元素的结构已在 前面描述。 下表描述了响应中特定于 simple 触发器的部分的结构:
Path | Type | Description |
---|---|---|
|
|
Simple trigger specific details. |
|
|
Interval, in milliseconds, between two executions. |
|
|
Number of times the trigger should repeat, or -1 to repeat indefinitely. |
|
|
Number of times the trigger has already fired. |
Daily Time Interval 触发器响应结构
daily time interval 触发器用于基于每日重复时间间隔触发作业。 此类触发器实现的响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 667
{
"group" : "samples",
"name" : "example",
"description" : "Example trigger",
"state" : "PAUSED",
"type" : "dailyTimeInterval",
"calendarName" : "bankHolidays",
"startTime" : "2020-11-30T17:00:00.000+00:00",
"endTime" : "2020-12-30T03:00:00.000+00:00",
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 5,
"finalFireTime" : "2020-12-30T10:00:00.000+00:00",
"data" : { },
"dailyTimeInterval" : {
"interval" : 3600000,
"daysOfWeek" : [ 3, 5 ],
"startTimeOfDay" : "09:00:00",
"endTimeOfDay" : "18:00:00",
"repeatCount" : -1,
"timesTriggered" : 0
}
}
响应的很大一部分对所有触发器类型都是通用的。 响应中通用元素的结构已在 前面描述。 下表描述了响应中特定于 daily time interval 触发器的部分的结构:
Path | Type | Description |
---|---|---|
|
|
Daily time interval trigger specific details. |
|
|
Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat. |
|
|
An array of days of the week upon which to fire. |
|
|
Time of day to start firing at the given interval, if any. |
|
|
Time of day to complete firing at the given interval, if any. |
|
|
Number of times the trigger should repeat, or -1 to repeat indefinitely. |
|
|
Number of times the trigger has already fired. |
Calendar Interval 触发器响应结构
calendar interval 触发器用于基于重复日历时间间隔触发作业。 此类触发器实现的响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 675
{
"group" : "samples",
"name" : "example",
"description" : "Example trigger",
"state" : "NORMAL",
"type" : "calendarInterval",
"calendarName" : "bankHolidays",
"startTime" : "2020-11-30T17:00:00.000+00:00",
"endTime" : "2020-12-30T03:00:00.000+00:00",
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 5,
"finalFireTime" : "2020-12-28T17:00:00.000+00:00",
"data" : { },
"calendarInterval" : {
"interval" : 604800000,
"timeZone" : "Asia/Shanghai",
"timesTriggered" : 0,
"preserveHourOfDayAcrossDaylightSavings" : false,
"skipDayIfHourDoesNotExist" : false
}
}
响应的很大一部分对所有触发器类型都是通用的。 响应中通用元素的结构已在 前面描述。 下表描述了响应中特定于 calendar interval 触发器的部分的结构:
Path | Type | Description |
---|---|---|
|
|
Calendar interval trigger specific details. |
|
|
Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat. |
|
|
Time zone within which time calculations will be performed, if any. |
|
|
Number of times the trigger has already fired. |
|
|
Whether to fire the trigger at the same time of day, regardless of daylight saving time transitions. |
|
|
Whether to skip if the hour of the day does not exist on a given day. |
Custom 触发器响应结构
custom 触发器是任何其他实现。 此类触发器实现的响应结果类似于以下内容:
HTTP/1.1 200 OK
Content-Type: application/vnd.spring-boot.actuator.v3+json
Content-Length: 457
{
"group" : "samples",
"name" : "example",
"description" : "Example trigger.",
"state" : "NORMAL",
"type" : "custom",
"calendarName" : "bankHolidays",
"startTime" : "2020-11-30T17:00:00.000+00:00",
"endTime" : "2020-12-30T03:00:00.000+00:00",
"previousFireTime" : "2020-12-04T03:00:00.000+00:00",
"nextFireTime" : "2020-12-07T03:00:00.000+00:00",
"priority" : 10,
"custom" : {
"trigger" : "com.example.CustomTrigger@fdsfsd"
}
}
响应的很大一部分对所有触发器类型都是通用的。 响应中通用元素的结构已在 前面描述。 下表描述了响应中特定于 custom 触发器的部分的结构:
Path | Type | Description |
---|---|---|
|
|
Custom trigger specific details. |
|
|
A toString representation of the custom trigger instance. |