Skip to content
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

Added support to Quartz Plugins And Listeners #10967

Merged
merged 1 commit into from
Jul 29, 2020
Merged

Added support to Quartz Plugins And Listeners #10967

merged 1 commit into from
Jul 29, 2020

Conversation

marcelorubim
Copy link
Contributor

Added support to Quartz Plugins And Listeners, as described on issue #10962

Fix #10962

@marcelorubim marcelorubim changed the title Fixes #10962 Added support to Quartz Plugins And Listeners Jul 25, 2020
@marcelorubim
Copy link
Contributor Author

Well, there is no log at the failed pipe (Quarkus CI / JDK Java 14 JVM Tests (pull_request)). Should I send another commit to it to retry?

@mkouba
Copy link
Contributor

mkouba commented Jul 27, 2020

Hi @marcelorubim, thanks for your contribution! Your PR should include at least some basic tests (you can follow the tests in https://github.com/quarkusio/quarkus/tree/master/extensions/quartz/deployment/src/test/java/io/quarkus/quartz/test). Furthermore, your branch should be squashed down to a single buildable commit. And finally, the issue is still being discussed so pls keep an eye on the comments...

.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addClasses(Jobs.class)
.addAsResource(new StringAsset(
"quarkus.quartz.plugin.shutdownhook.class=org.quartz.plugins.management.ShutdownHookPlugin\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not a good plugin to test. We do shutdown the quartz scheduler when a quarkus app/test stops ;-).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is because if I register an invalid plugin, the Quartz won't start. The test can check if parsing the config to Quartz properties is working fine.

Copy link
Member

@machi1990 machi1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR @marcelorubim I'd suggest we test we add an integration test too. Things like class registration for reflection would most likely be needed and having an integration test https://github.com/quarkusio/quarkus/tree/master/integration-tests/quartz would most likely show this up and avoid future regressions.

@marcelorubim
Copy link
Contributor Author

Thank you for the PR @marcelorubim I'd suggest we test we add an integration test too. Things like class registration for reflection would most likely be needed and having an integration test https://github.com/quarkusio/quarkus/tree/master/integration-tests/quartz would most likely show this up and avoid future regressions.

Added this on application.properties on the integration test:

# Register de LoggingJobHistoryPlugin for testing
quarkus.quartz.plugin.jobHistory.class=org.quartz.plugins.history.LoggingJobHistoryPlugin
quarkus.quartz.plugin.jobHistory.jobSuccessMessage=Job [{1}.{0}] execution complete and reports: {8}

And this to QuartzProcessor.

        config.triggerListeners.values().forEach((value) -> {
            reflectiveClasses.add(new ReflectiveClassBuildItem(true, false, value.clazz));
        });

        config.jobListeners.values().forEach((value) -> {
            reflectiveClasses.add(new ReflectiveClassBuildItem(true, false, value.clazz));
        });

        config.plugins.values().forEach((value) -> {
            reflectiveClasses.add(new ReflectiveClassBuildItem(true, false, value.clazz));
        });

Now seems to works just fine on native mode.

@marcelorubim marcelorubim requested a review from machi1990 July 27, 2020 19:18
Copy link
Member

@machi1990 machi1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcelorubim thank you for the wonderful work. It is looking great, I like your configuration proposal much better than the plain Map<String, Map<String, String>>.

I've added comments, and once they are addressed this is good to merge.

@machi1990 machi1990 self-requested a review July 28, 2020 17:33
Copy link
Member

@machi1990 machi1990 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @marcelorubim. All good for me.

@mkouba do you want to have a look?

@machi1990 machi1990 requested a review from mkouba July 28, 2020 19:02
Copy link
Contributor

@mkouba mkouba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good. I've added few minor docs comments.

@mkouba mkouba added this to the 1.7.0 - master milestone Jul 29, 2020
@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Jul 29, 2020
Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor gripe: any chance you could adjust the commit message? git commit --amend should allow you to do that and then force push.

Thanks!

@marcelorubim marcelorubim requested a review from gsmet July 29, 2020 10:54
@gsmet
Copy link
Member

gsmet commented Jul 29, 2020

Thanks! Let's wait for CI and merge.

@gsmet gsmet merged commit 2a5b0a0 into quarkusio:master Jul 29, 2020
@gsmet
Copy link
Member

gsmet commented Jul 29, 2020

Merged, thanks!

@machi1990
Copy link
Member

Thank you @marcelorubim for the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/documentation area/scheduler triage/waiting-for-ci Ready to merge when CI successfully finishes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add a way to configure "plugins" and "listeners" for the quartz scheduler
4 participants