-
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
base: main
Are you sure you want to change the base?
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
…lexibility to users
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? :) |
Status for workflow
|
Status | Name | Step | Failures | Logs | Raw logs | Build scan |
---|---|---|---|---|---|---|
✖ | Native Tests - Virtual Thread - Main | Build |
Logs | Raw logs | 🔍 |
You can consult the Develocity build scans.
.reason(getClass().getName()) | ||
.methods().build()); | ||
} else { | ||
reflectiveClasses.add(ReflectiveClassBuildItem.builder(QuarkusDBv8Delegate.class.getName()) |
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't you register for reflection only the dialects that could be triggered by the available JdbcDataSourceBuildItem
?
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.
Not sure I follow.
The use case here is to delay choosing the datasource until runtime, so how would I know which one to register?
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.
A JdbcDataSourceBuildItem
has a dbKind
that is fixed at build time. So from them, you can deduce the list of databases that you have to support.
E.g. you have two datasources, one MySQL, one PostgreSQL, the dbKind
of the datasources is defined at build so you know which ones might be useful, you don't need to register for reflection all of them.
Note: we also need to support when the kind is something we don't know, but I think we currently push something generic in this case? And you can hardcode it anyway.
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.
Ah, right I get it now.
+1, that makes sense
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 |
Resolves #48545