-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Quartz - Defer driver discovery to runtime in order to provide more flexibility to users #48579
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
Conversation
EDIT: I have tested this with the reproducer provided by the user (see this comment) and it passes. |
extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java
Outdated
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
I am aware that this PR does not move the build time config property into runtime config because I am frankly not sure if that would be breaking - technically it will have the same name but anything operating with the build time config might be affected by it. We could also temporarily duplicate them in both and deprecate one. Anyhow, @mkouba thoughts on the approach in this PR and the config change? :) |
This comment has been minimized.
This comment has been minimized.
extensions/quartz/deployment/src/main/java/io/quarkus/quartz/deployment/QuartzProcessor.java
Outdated
Show resolved
Hide resolved
I can't say that I completely understand the use case 🤔. If a user sets the |
Take a look at the discussion on the issue - #48545 (comment)
Maybe I don't fully understand but it seems that wouldn't work here. Of course it is a matter of how much runtime flexibility we want to give it. This PR is just my attempt at grasping the use case and coming up with something that would make the reproducer pass. |
My point is - if a user sets Now, it seems that the user needs to define multiple data sources, deactivate some and select one for Quartz at runtime. This means we would need to relax the validation at build time. Which is 👎. Also I think it's breaking because the behavior's changed. And the The question is: could we introduce two new config properties that would be used if no DS is selected at build time ( |
Yes but that's not what the reproducer does. In it, there is no value set by user and only the interceptor exists so that it can give you the config value "dynamically", so to speak.
Breaking in what way? Currently you'd only not get as fast failure if you misconfigured it but otherwise it should appear to behave equally on the outside?
It is not the first time we hear about the need to have multiple DS, it's just that Quartz bit didn't have to deal with it yet.
Hm, interesting idea. However, in such a case, wouldn't it be easier to keep |
The idea is to keep
I don't think it's a good idea. You can't treat a build config property as runtime and vice versa. They are processed differently. I.e. there is no way to tell Quarkus that |
Well, it is available in both and we'd mostly process it in build time anyway but I get that it's not right on the theoretical level. Either way, I will revert this to draft, circle back to it early next week and try to come up with something more profound :) |
There is more to it. Runtime and build-time properties are processed differently which might lead to strange and/or well-hidden errors. There are things like |
I've reworked the PR and there are now two new config knobs:
Furthermore the classes registered for reflection in case of deferred resolution are now curated based on the set of known JDBC DS build items (as per Guillaume's comment). I've also tested this with the user provided dual-DB reproducer and got a pass. |
The CI failure is definitely related, taking a look... |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🎊 PR Preview 4745e81 has been successfully built and deployed to https://quarkus-pr-main-48579-preview.surge.sh/version/main/guides/
|
6f44d5a
to
e84b360
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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.
It looks very good but I wonder if we shouldn't add a test as well?
Done, the following changes are now part of the PR:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
.../deployment/src/main/java/io/quarkus/quartz/deployment/QuartzJDBCDriverDialectBuildItem.java
Outdated
Show resolved
Hide resolved
...loyment/src/test/java/io/quarkus/quartz/test/InvalidDeferredDatasourceConfigurationTest.java
Show resolved
Hide resolved
…er to provide more flexibility to users
Addressed all of the comments and rebased onto main. |
Status for workflow
|
Status for workflow
|
Resolves #48545