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" ]
  }
}

响应结构

响应包含已注册作业和触发器的组名。 下表描述了响应的结构:

Path Type Description

jobs.groups

Array

An array of job group names.

triggers.groups

Array

An array of trigger group names.

获取已注册的作业名称

要获取已注册的作业名称列表,向 /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" ]
    }
  }
}

响应结构

响应包含每个组中已注册的作业名称。 下表描述了响应的结构:

Path Type Description

groups

Object

Job groups keyed by name.

groups.*.jobs

Array

An array of job names.

获取已注册的触发器名称

要获取已注册的触发器名称列表,向 /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" ]
    }
  }
}

响应结构

响应包含每个组中已注册的触发器名称。 下表描述了响应的结构:

Path Type Description

groups

Object

Trigger groups keyed by name.

groups.*.paused

Boolean

Whether this trigger group is paused.

groups.*.triggers

Array

An array of trigger names.

获取作业组概览

要获取特定组中作业的概览,向 /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"
    }
  }
}

响应结构

响应包含特定组中作业的概览。 下表描述了响应的结构:

Path Type Description

group

String

Name of the group.

jobs

Object

Job details keyed by name.

jobs.*.className

String

Fully qualified name of the job implementation.

获取触发器组概览

要获取特定组中触发器的概览,向 /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

group

String

Name of the group.

paused

Boolean

Whether the group is paused.

triggers.cron

Object

Cron triggers keyed by name, if any.

triggers.simple

Object

Simple triggers keyed by name, if any.

triggers.dailyTimeInterval

Object

Daily time interval triggers keyed by name, if any.

triggers.calendarInterval

Object

Calendar interval triggers keyed by name, if any.

triggers.custom

Object

Any other triggers keyed by name, if any.

triggers.cron.*.previousFireTime

String

Last time the trigger fired, if any.

triggers.cron.*.nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

triggers.cron.*.priority

Number

Priority to use if two triggers have the same scheduled fire time.

triggers.cron.*.expression

String

Cron expression to use.

triggers.cron.*.timeZone

String

Time zone for which the expression will be resolved, if any.

triggers.simple.*.previousFireTime

String

Last time the trigger fired, if any.

triggers.simple.*.nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

triggers.simple.*.priority

Number

Priority to use if two triggers have the same scheduled fire time.

triggers.simple.*.interval

Number

Interval, in milliseconds, between two executions.

triggers.dailyTimeInterval.*.previousFireTime

String

Last time the trigger fired, if any.

triggers.dailyTimeInterval.*.nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

triggers.dailyTimeInterval.*.priority

Number

Priority to use if two triggers have the same scheduled fire time.

triggers.dailyTimeInterval.*.interval

Number

Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat.

triggers.dailyTimeInterval.*.daysOfWeek

Array

An array of days of the week upon which to fire.

triggers.dailyTimeInterval.*.startTimeOfDay

String

Time of day to start firing at the given interval, if any.

triggers.dailyTimeInterval.*.endTimeOfDay

String

Time of day to complete firing at the given interval, if any.

triggers.calendarInterval.*.previousFireTime

String

Last time the trigger fired, if any.

triggers.calendarInterval.*.nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

triggers.calendarInterval.*.priority

Number

Priority to use if two triggers have the same scheduled fire time.

triggers.calendarInterval.*.interval

Number

Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat.

triggers.calendarInterval.*.timeZone

String

Time zone within which time calculations will be performed, if any.

triggers.custom.*.previousFireTime

String

Last time the trigger fired, if any.

triggers.custom.*.nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

triggers.custom.*.priority

Number

Priority to use if two triggers have the same scheduled fire time.

triggers.custom.*.trigger

String

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

group

String

Name of the group.

name

String

Name of the job.

description

String

Description of the job, if any.

className

String

Fully qualified name of the job implementation.

durable

Boolean

Whether the job should remain stored after it is orphaned.

requestRecovery

Boolean

Whether the job should be re-executed if a 'recovery' or 'fail-over' situation is encountered.

data.*

String

Job data map as key/value pairs, if any.

triggers

Array

An array of triggers associated to the job, if any.

triggers.[].group

String

Name of the trigger group.

triggers.[].name

String

Name of the trigger.

triggers.[].previousFireTime

String

Last time the trigger fired, if any.

triggers.[].nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

triggers.[].priority

Number

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

group

String

Name of the group.

name

String

Name of the trigger.

description

String

Description of the trigger, if any.

state

String

State of the trigger (NONE, NORMAL, PAUSED, COMPLETE, ERROR, BLOCKED).

type

String

Type of the trigger (calendarInterval, cron, custom, dailyTimeInterval, simple). Determines the key of the object containing type-specific details.

calendarName

String

Name of the Calendar associated with this Trigger, if any.

startTime

String

Time at which the Trigger should take effect, if any.

endTime

String

Time at which the Trigger should quit repeating, regardless of any remaining repeats, if any.

previousFireTime

String

Last time the trigger fired, if any.

nextFireTime

String

Next time at which the Trigger is scheduled to fire, if any.

priority

Number

Priority to use if two triggers have the same scheduled fire time.

finalFireTime

String

Last time at which the Trigger will fire, if any.

data

Object

Job data map keyed by name, if any.

calendarInterval

Object

Calendar time interval trigger details, if any. Present when type is calendarInterval.

custom

Object

Custom trigger details, if any. Present when type is custom.

cron

Object

Cron trigger details, if any. Present when type is cron.

dailyTimeInterval

Object

Daily time interval trigger details, if any. Present when type is dailyTimeInterval.

simple

Object

Simple trigger details, if any. Present when type is simple.

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

Object

Cron trigger specific details.

cron.expression

String

Cron expression to use.

cron.timeZone

String

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

Object

Simple trigger specific details.

simple.interval

Number

Interval, in milliseconds, between two executions.

simple.repeatCount

Number

Number of times the trigger should repeat, or -1 to repeat indefinitely.

simple.timesTriggered

Number

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

dailyTimeInterval

Object

Daily time interval trigger specific details.

dailyTimeInterval.interval

Number

Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat.

dailyTimeInterval.daysOfWeek

Array

An array of days of the week upon which to fire.

dailyTimeInterval.startTimeOfDay

String

Time of day to start firing at the given interval, if any.

dailyTimeInterval.endTimeOfDay

String

Time of day to complete firing at the given interval, if any.

dailyTimeInterval.repeatCount

Number

Number of times the trigger should repeat, or -1 to repeat indefinitely.

dailyTimeInterval.timesTriggered

Number

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

calendarInterval

Object

Calendar interval trigger specific details.

calendarInterval.interval

Number

Interval, in milliseconds, added to the fire time in order to calculate the time of the next trigger repeat.

calendarInterval.timeZone

String

Time zone within which time calculations will be performed, if any.

calendarInterval.timesTriggered

Number

Number of times the trigger has already fired.

calendarInterval.preserveHourOfDayAcrossDaylightSavings

Boolean

Whether to fire the trigger at the same time of day, regardless of daylight saving time transitions.

calendarInterval.skipDayIfHourDoesNotExist

Boolean

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

Object

Custom trigger specific details.

custom.trigger

String

A toString representation of the custom trigger instance.