-
Notifications
You must be signed in to change notification settings - Fork 40.7k
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
Add the ability to trigger a Quartz job on-demand through an Actuator endpoint #43086
base: main
Are you sure you want to change the base?
Conversation
c20c53d
to
8dbd473
Compare
@@ -298,7 +298,7 @@ protected interface LinksHandler { | |||
@FunctionalInterface | |||
protected interface ReactiveWebOperation { | |||
|
|||
Mono<ResponseEntity<Object>> handle(ServerWebExchange exchange, Map<String, String> body); | |||
Mono<ResponseEntity<Object>> handle(ServerWebExchange exchange, Map<String, Object> body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why you had to change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment regarding these changes in the #42530 (comment)
The Map<String, String> request body does not support complex values like Map or List, only basic JSON types.
For example, this JSON is not supported at the moment:
{
"jobData": {
"key": "value"
}
}
WebMvc:
[org.springframework.http.converter.HttpMessageNotReadableException:
JSON parse error: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)]
WebFlux:
org.springframework.core.codec.DecodingException: JSON decoding error: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, we don't intend to support arbitrary input this way. This part is covered in the reference guide.
Can you please revert to allow jobs to be invoked on demand without custom data?
In the comment you've referenced you stated that "By the way, Jersey works fine". I am not sure what you mean by that but if there is something that needs to be done for things to work currently the same way on all stacks, please create a separate issue with more details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that @WebEndpointTest
with JERSEY
infrastructure does support Map<String, Object
as an endpoint parameter.
If I revert my changes related to @RequestBody Map<String, Object
the MVC and WebFlux will fail but Jersey will not.
You can reproduce this issue by running this test QuartzEndpointWebIntegrationTests.quartzTriggerJobWithCustomData
Branch: https://github.com/nosan/spring-boot/tree/42530-map-issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
860d875
to
709aa31
Compare
… 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
Thanks, @snicoll |
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 optionalJobDataMap
.See gh-42530