Skip to content

Add execution information in Quartz job detail #43226

Open
@snicoll

Description

@snicoll

Reviewing #43086 and brainstorming with @wilkinsona we believe that the detail of a job should specify whether it's running or not and additional information if it is.

Doing so will help with triggering a new execution on demand.

The detail of a test job is currently as follows:

{
    "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
    "data": {},
    "durable": true,
    "group": "DEFAULT",
    "name": "testJob",
    "requestRecovery": false,
    "triggers": [
            "group": "DEFAULT",
            "name": "testJobTrigger",
            "nextFireTime": "2024-11-20T10:26:43.791+00:00",
            "previousFireTime": "2024-11-20T10:25:43.791+00:00",
            "priority": 5
    ]
}

For a Job who's currently running, we'd like the description to improve as follows:

{
  "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
  "data": {},
  "durable": true,
  "group": "DEFAULT",
  "name": "testJob",
  "requestRecovery": false,
  "running": true,
  "triggers": [
    {
      "executions": {
        "previous": "2024-11-20T10:25:43.791+00:00",
        "next": "2024-11-20T10:26:43.791+00:00",
        "current": {
          "fireTime": "2024-11-20T10:25:43.794+00:00",
          "recovering": false,
          "refireCount": 0
        }
      },
      "group": "DEFAULT",
      "name": "testJobTrigger",
      "priority": 5
    }
  ]
}

If the job is not running, it would be:

{
  "className": "com.example.demoquartz.DemoQuartzApplication$TestJob",
  "data": {},
  "durable": true,
  "group": "DEFAULT",
  "name": "testJob",
  "requestRecovery": false,
  "running": false,
  "triggers": [
    {
      "executions": {
        "previous": "2024-11-20T10:25:43.791+00:00",
        "next": "2024-11-20T10:26:43.791+00:00",
      },
      "group": "DEFAULT",
      "name": "testJobTrigger",
      "priority": 5
    }
  ]
}

For backward compatible reason, the nextFireTime and previousFireTime should still be present but we'll stop documenting them.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions