-
Notifications
You must be signed in to change notification settings - Fork 2.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
Don't create default mongo clients when not needed and fix @MongoClientName qualifier #11568
Conversation
Is iterating over all the injection point has a cost ? I don't know how many of injection points exists in a classical application so I dont't know if it can add a lot of build time cost. This will not work for MongoDB with Panache as we set all clients unremovable.
|
The cost is negligible. This same operation is performed in other extensions as well.
Yeah, as you said all will be made unremovable, but that should not be a problem. |
OK, so it fixes the issue only for direct usage of the MongoDB client not via Panache. |
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.
LGTM
It only fixes a part unfortunately. There is still the CDI related part that I mentioned in the issue that we need Martin to look at (I could of course, but it would take me a lot longer than Martin :)) |
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.
Looks good.
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.
Added some suggestion.
Also what worries me here is that we aren't consistent with the behavior elsewhere.
I think it all boils down to the "we need to be able to know if a runtime property will be set" discussion.
...lient/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientBuildTimeConfig.java
Outdated
Show resolved
Hide resolved
Not really... If you know the injection points (which we do), then you know which mongo clients you need. Unless I am missing something? |
What if you programmatically get the bean? Isn't that a possibility? |
This works for Panache and Camel because in those cases the bean does get created. For users that would want to do that, then the new setting can be used. |
@gsmet is this OK with you? |
BeanDefiningAnnotationBuildItem registerConnectionBean() { | ||
return new BeanDefiningAnnotationBuildItem(MONGOCLIENT_ANNOTATION); | ||
} | ||
private static final DotName MONGO_CLIENT_ANNOTATION = DotName.createSimple(MongoClientName.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.
If it didn't work before, please let's move this annotation to the API package i.e. no runtime.
. It's user API.
Also we will probably need to update the doc and quickstart if it's mentioned.
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.
Agreed to do this in a follow up
For now we just deprecate the one annotation and support both Relates to: quarkusio#11568 (comment)
For now we just deprecate the one annotation and support both Relates to: quarkusio#11568 (comment)
For now we just deprecate the one annotation and support both Relates to: quarkusio#11568 (comment)
For now we just deprecate the one annotation and support both Relates to: quarkusio#11568 (comment)
For now we just deprecate the one annotation and support both Relates to: quarkusio#11568 (comment)
For now we just deprecate the one annotation and support both Relates to: quarkusio#11568 (comment)
This one has been backported via a specific PR due to conflicts: #11849 . |
Fixes: #11491