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

Fix broken MongoClientBuildItem support #7385

Merged
merged 1 commit into from
Feb 25, 2020
Merged

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Feb 24, 2020

Fixes: #7378

@geoand
Copy link
Contributor Author

geoand commented Feb 24, 2020

There is one thing that needs to change however for MongoClientBuildItem.

The value of each RuntimeValue needs to become an optional instead of an actual client. The reason is that if the client is never injected into application code, the bean is never created.

@loicmathieu
Copy link
Contributor

The reason is that if the client is never injected into application code, the bean is never created.

This is the behaviour I will need to change ...

@geoand
Copy link
Contributor Author

geoand commented Feb 24, 2020

The reason is that if the client is never injected into application code, the bean is never created.

This is the behaviour I will need to change ...

Yes of course, but it's necessary, otherwise we need to make the beans unremovable which goes counter to the point of the optimization :)

@loicmathieu
Copy link
Contributor

we need to make the beans unremovable which goes counter to the point of the optimization :)

I don't really see the point of defining a mongoclient connection and not using it in the code. I don't think that bean removal should cover such case.

@geoand
Copy link
Contributor Author

geoand commented Feb 24, 2020

That's not the issue 😉

The issue is that user code can use only the blocking client and not the reactive client. In that case, no bean will be created for the reactive client. Ditto if the opposite happens.

We definitely can make the beans unremoveable, but that goes counter to what the optimization actually is meant for.

@loicmathieu
Copy link
Contributor

That's not the issue

That's mine, but I will look at it later, let stop the digression here :)

@geoand
Copy link
Contributor Author

geoand commented Feb 24, 2020

I am not hell bent on the Optional thing, I'm just saying it's the proper thing to do. If it's too much of a hassle for the consumers of the Build Item to update, then we can make the bean unremovable :)

@loicmathieu
Copy link
Contributor

@geoand in fact I just have an enlightment (I don't know if it's the correct word). @MongoClientName as a base for removing bean is not suitable for my use case but I have the @MongoEntity(clientName) annotation so I should be able to define a UnremovableBeanBuildItem to tell Arc to avoid removing the client I need even if the @MongoClientName is not used ! This will fix my issue ! 🎉

@geoand
Copy link
Contributor Author

geoand commented Feb 24, 2020

Excellent 👌

@geoand geoand marked this pull request as ready for review February 24, 2020 23:06
@geoand geoand requested a review from gsmet February 24, 2020 23:10
@geoand geoand added this to the 1.3.0 milestone Feb 24, 2020
Copy link
Contributor

@loicmathieu loicmathieu left a comment

Choose a reason for hiding this comment

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

LGTM but I will need to test it to see if it fixes my issue.
Maybe hold on to merge it untill I have time to test it (end of week)

@geoand
Copy link
Contributor Author

geoand commented Feb 25, 2020

The issue is we really need this for Camel. So I propose merging ASAP and then making any extra charges if necessary when you have the time to test

@loicmathieu
Copy link
Contributor

I'm OK with this, I didn't saw prior to my comment that it fixes the issue for Camel.
So let's merge it, I'll give you feedback later on this.

@geoand
Copy link
Contributor Author

geoand commented Feb 25, 2020

Thanks

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.

I don't have the time to carefully review this so I'm gonna trust you on that one, considering it's blocking for Camel and CI is green.

@gsmet gsmet merged commit 6ecb8bc into quarkusio:master Feb 25, 2020
@geoand geoand deleted the #7378 branch February 25, 2020 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MongoClientBuildItem is never produced
3 participants