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

Reactive - Support multi hosts connection to Postgres #29348

Closed
mcanzerini opened this issue Nov 18, 2022 · 11 comments · Fixed by #29397
Closed

Reactive - Support multi hosts connection to Postgres #29348

mcanzerini opened this issue Nov 18, 2022 · 11 comments · Fixed by #29397
Assignees
Milestone

Comments

@mcanzerini
Copy link

mcanzerini commented Nov 18, 2022

Description

I need to connect to multiple postgres hosts with hibernate-reactive.

With the classic jdbc driver, we can define this property to connect to our HA postgres instance:

quarkus.datasource.jdbc.url=jdbc:postgresql://my.host-1.com,my.host-2.com,my.host-3.com:5432/myDB

But here I saw that the vert.x PgClient does not support multi host connections directly in connection URI.

I created an issue in vertx-sql-client here and a developer said me that it would be already possible by using the PgConnectOptions and a PgPool.

Can you support connection pool to multi hosts through your implementation ?

@quarkus-bot
Copy link

quarkus-bot bot commented Nov 21, 2022

/cc @tsegismont, @vietj

@tsegismont
Copy link
Contributor

@geoand do you know if it is possible to customize connect options in user code?

@mcanzerini as a workaroud, you create the PgPool directly in your application (with your own config options)

@geoand
Copy link
Contributor

geoand commented Nov 21, 2022

@geoand do you know if it is possible to customize connect options in user code?

If you are looking for a way to customize the PgConnectOptions that Quarkus creates, then no. But I do think it would be something useful.
If we do decide to add something like that, we'll need to do it for all reactive drivers (and probably the non-reactive ones as well).

Or maybe it makes sense for users to customize the pool instead? Let me know what you think and I can provide an initial PR showing how this can be done.

@tsegismont
Copy link
Contributor

tsegismont commented Nov 21, 2022 via email

@geoand
Copy link
Contributor

geoand commented Nov 21, 2022

None of the datasource extensions do this IIRC.

I'll open a draft tomorrow to show you what I have in mind (which is in line with the way other extensions like Jackson for example handle such cases)

@tsegismont
Copy link
Contributor

tsegismont commented Nov 21, 2022 via email

@geoand
Copy link
Contributor

geoand commented Nov 22, 2022

you create the PgPool directly in your application (with your own config options)

If you do this, make sure to make the PgPool a bean in order to override the Quarkus provided bean.

@geoand
Copy link
Contributor

geoand commented Nov 22, 2022

@tsegismont #29397 is what I have in mind (cc @gsmet for awareness as well).
If we agree on that approach, I'll do the same thing for the other reactive drivers as well.

geoand added a commit to geoand/quarkus that referenced this issue Nov 22, 2022
geoand added a commit to geoand/quarkus that referenced this issue Nov 22, 2022
@mcanzerini
Copy link
Author

Hi guys, any update on this ?
Thanks !

@geoand
Copy link
Contributor

geoand commented Dec 9, 2022

Hopefully soon :)

@mcanzerini
Copy link
Author

Great, thanks for your time 🙏

geoand added a commit to geoand/quarkus that referenced this issue Jan 16, 2023
@geoand geoand self-assigned this Jan 16, 2023
cescoffier added a commit that referenced this issue Jan 29, 2023
Provide a way for users to customize PgPool creation
@quarkus-bot quarkus-bot bot added this to the 2.17 - main milestone Jan 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants