Skip to content

Add a capability to trigger a quartz job on-demand via the actuator endpoint #42530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mranile-dev opened this issue Oct 9, 2024 · 3 comments
Labels
type: enhancement A general enhancement

Comments

@mranile-dev
Copy link

Currently, SB is having actuator endpoints to retrieve details of Quartz scheduled jobs and its triggers. This feature request is to extend the actuators capability to be able to do the following:

  1. On-demand trigger of any Quartz job(s)
  2. Ability to override or update the existing cron expression of the specific job(s)
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 9, 2024
@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label Oct 9, 2024
@philwebb
Copy link
Member

We think that 1) is possible, and hopefully not too hard to implement. 2) is pretty hard because Quartz supports multiple trigger types.

@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Oct 21, 2024
@philwebb philwebb added this to the General Backlog milestone Oct 21, 2024
@nosan
Copy link
Contributor

nosan commented Nov 5, 2024

I've worked a little bit on this issue, especially the trigger job on demand part. I've prototyped some changes in my branch.

To trigger a job on demand, overall does not require a lot of changes and can be implemented, but it requires some changes in AbstractWebFluxEndpointHandlerMapping and AbstractWebMvcEndpointHandlerMapping since both of them do not support Map<String, Object> as an endpoint parameter. (Consider as a bug? By the way, Jersey works fine)

To support Map<String, Object> as an endpoint parameter the following should be changed
in both classes:

@RequestBody(required = false) Map<String, String> body should be changed to @RequestBody(required = false) Map<String, Object> body, otherwise the following exception will be thrown:

[org.springframework.http.converter.HttpMessageNotReadableException: 
JSON parse error: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)]

Regarding the ability to override or update the existing trigger of the specific job. I am
not sure whether it is worth supporting this at all. For example, I checked the QuartzSchedulerMBean interface and it does not have such functionality for JMX, at least I haven't found it. Overall, it could be implemented, but it requires a quite significant piece of work.

@mranile-dev
Copy link
Author

Let's implement capability #1 for now if it's doable. It will be a good feature for remotely triggering the job on-demand without waiting on the next scheduled trigger. Thanks @nosan Cheers!

nosan added a commit to nosan/spring-boot that referenced this issue Nov 10, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible. This commit introduces a new @WriteOperation endpoint at /actuator/quartz/jobs/{groupName}/{jobName}/trigger, allowing a job to be triggered by specifying the jobName, groupName, and an optional JobDataMap

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 10, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible. This commit introduces a new @WriteOperation endpoint at /actuator/quartz/jobs/{groupName}/{jobName}/trigger, allowing a job to be triggered by specifying the jobName, groupName, and an optional JobDataMap

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 13, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint at /actuator/quartz/jobs/{groupName}/{jobName}/trigger,
 allowing a job to be triggered by specifying the jobName,
 groupName, and an optional JobDataMap

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 14, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint at /actuator/quartz/jobs/{groupName}/{jobName}/trigger,
 allowing a job to be triggered by specifying the jobName,
 groupName, and an optional JobDataMap

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 18, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName}/trigger,
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 18, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName}/trigger,
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 18, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName}/trigger,
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 20, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName},
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 20, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName},
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Nov 20, 2024
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName},
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530
nosan added a commit to nosan/spring-boot that referenced this issue Jan 30, 2025
… endpoint

Before this commit, triggering a Quartz job on demand was not possible.
This commit introduces a new @WriteOperation endpoint
at /actuator/quartz/jobs/{groupName}/{jobName},
allowing a job to be triggered by specifying the jobName and groupName

See spring-projectsgh-42530

Signed-off-by: Dmytro Nosan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants