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
3343: add multi mongo db support #4529
Conversation
Seems like some of the tests are failing. @dufoli would you like to give some details about this PR? |
@geoand I have fixed tests and many tests succeed!:
but a test is still failing: CollectionManagementTest I need help for the remaining test. IT fail with a timeout and before a really strange error on mongo side: |
I need review and help to format. Because it seems to be ok but failing on code format.... |
Please run |
Yo bro. I like to see you code in Java ;) |
good news, I have fixed the issue with codec. The mongodb test is succeed now but I have impact on panache over mongo. So I have to deep dive on it. |
Good to hear! |
For the panache case. I think you can get the default connection for a first shoot. And create an issue to treate it in a separate way. |
@loicmathieu since you have plenty of Mongo experience, would you like to check the PR out and let us know what you think? |
...ongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/MongoOperations.java
Outdated
Show resolved
Hide resolved
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.
I check globally the PR and ask some changes.
I don't check all the mongo connection initialization code, I hope you copy/paste it from the existing one :)
I can help for the Mongodb With Panache part if you didn't succeed to make it works.
After this PR is merged, we should update Mongodb With Panache to support multiple MongoClient, you can open an issue for this afterwards I'll take care of it.
...t/deployment/src/main/java/io/quarkus/mongodb/deployment/DataSourceInitializedBuildItem.java
Outdated
Show resolved
Hide resolved
...godb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java
Outdated
Show resolved
Hide resolved
...godb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java
Outdated
Show resolved
Hide resolved
...godb-client/deployment/src/main/java/io/quarkus/mongodb/deployment/MongoClientProcessor.java
Outdated
Show resolved
Hide resolved
...odb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/AbstractMongoClientProducer.java
Outdated
Show resolved
Hide resolved
...odb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/AbstractMongoClientProducer.java
Outdated
Show resolved
Hide resolved
...odb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/AbstractMongoClientProducer.java
Outdated
Show resolved
Hide resolved
extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/Connection.java
Outdated
Show resolved
Hide resolved
extensions/mongodb-client/runtime/src/main/java/io/quarkus/mongodb/runtime/MongodbConfig.java
Outdated
Show resolved
Hide resolved
...ongodb-panache/runtime/src/main/java/io/quarkus/mongodb/panache/runtime/MongoOperations.java
Outdated
Show resolved
Hide resolved
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.
Just to be sure this gets properly squashed before merging. Please dismiss once everything is squashed properly.
Thanks!
5f7a2d1
to
36ef743
Compare
@geoand ping ;-) test has finished to run and now I get an error that I have not before my push. It do not succeed to get the producer to set up the config. I think it is because unremovable annotation make it failed to be created. I do not know why. producer is created in mongoClientProcessor. inside function createMongoClientProducerBean |
I have test many way to generated bean unremovable.... but still failing.
IT was my last attempt... I still do not understand order of call and how be sure that generatedBean is produce and loaded before make it unremovable (and on the right side (deployment and not runtime). |
@dufoli I'll checkout your branch today and have a look. To debug if it's really a bean removal you can:
|
@dufoli have you looked at the output of the generated producer (it would be found under |
@geoand the extension development guide says that classes are generated into memory during augmentation, and that a java property needs to be specified to have them outputed into a directory: https://quarkus.io/guides/extension-authors-guide#troubleshooting-debugging-tips |
@dufoli although not ideal, you could replace
with
and things will work (I tested). I would suggest however extracting the common things into a In that case, you'll (most likely) be able to pull the bean out of Arc using Does that make sense? |
@loicmathieu I am talking about doing the following:
|
Also @loicmathieu TBH, the guide seems incorrect. That property is useful for dev-mode not for a typical |
@geoand yes, I'm interesting on improving the guide. You can open an issue and assign it to me. |
@loicmathieu Thanks! Here you go: #4635 |
@loicmathieu @geoand I have fixed the unremovable issue. Indeed I reuse the previous code with UnremovableBeanBuildItem because annotation unremovable are not parsed for generated code. And using other code do not work either. Anyway, I am now stuck on the |
@geoand done! |
Thank you! We are having trouble with CI at the moment so it might be a while until we can get this in. |
@gsmet @cescoffier @geoand Hello, code is ready. I have just rebase. Can you merge it ? |
@dufoli Thanks. I need to take another look at this before merging. I'll let you know soon enough. |
I have just fixed the test. It was because quarkus test is more strict now with java archive class to declared. |
@dufoli this may have been brought up before, but was is the reason that the a bunch of tests have moved? |
the commits have been properly squashed
I think that once the testing question I have has been addressed we can merge this |
@geoand to be honnest, I do not remember... I can try to move it back to runtime part and check why. I think it was during a process of fixing. Not sure it was the root cause. AFAIK, I just do it because most of other extentions have it in deployment. |
@dufoli please check and let me know. If we clear that up, I think we can merge this |
@geoand I have retry to switch test folder back to runtime and update pom.cxml to reflect the change and I get these errors: 2020-02-05 22:44:15,939 WARN [io.qua.config] (main) Unrecognized configuration key "quarkus.mongodb.cluster1.connection-string" was provided; it will be ignored |
So I guess, it was done on purpose. I do not remember sadly the exact reason... It take too long time to review/merge sorry. |
OK, let's merge this! Thanks a lot for your hard work and patience @dufoli . |
The issue was reported here - quarkusio/quarkus#4529 (comment)
fix #3343
GOAL:
And then use annotations above the instances of MongoClient to indicate which instance we are going to use (example imaginary @connection annotation used):
I reuse(copy) a lot of code from agroal extention to have same structure. when I do not set codecs, it work well but codec test is failing. I need help to understand how to load codec during runtime and not deployment.
previous code: load mongoClient during runtime build step
new code: create producer for each named connection (like agroal extention) and buildstep during compile time.
depend of #5387. Have to wait that it land on master