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

Use memoize to concurrently cache in ConnectionHolder and RabbitMQConnector #1447

Merged
merged 1 commit into from
Oct 11, 2021

Conversation

kdubb
Copy link
Contributor

@kdubb kdubb commented Oct 7, 2021

Fixes #1446

The attempted method of caching used in ConnectionHolder and RabbitMQConnector is broken.

Take RabbitMQConnector.getSubscriberBuilder for example, if multiple subscriptions to getSender happen before a connection is established it's quite clear that multiple connections will be made; instead of just a single connection.

The same issue exists in ConnectionHolder in a slightly different fashion.

This PR replaces these failed attempts at caching with Uni.memoize to serialize and cache properly during concurrent requests.

… `RabbitMQConnector`

The attempted method of caching used in `ConnectionHolder` and `RabbitMQConnector` is broken.

Take `RabbitMQConnector.getSubscriberBuilder` for example, if multiple subscriptions to `getSender` happen before a  connection is established it's quite clear that multiple connections will be made; instead of just a single connection.

The same issue exists in `ConnectionHolder` in a slightly different fashion.

This PR replaces these failed attempts at caching with `Uni.memoize` to serialize and cache properly during concurrent requests.
@kdubb kdubb changed the title Use memoize to properly serialize & cache in ConnectionHolder and RabbitMQConnector Use memoize to concurrently cache in ConnectionHolder and RabbitMQConnector Oct 7, 2021
@cescoffier
Copy link
Contributor

Thanks!

@cescoffier cescoffier added bug Something isn't working rabbitmq labels Oct 8, 2021
@cescoffier cescoffier added this to the 3.11.0 milestone Oct 8, 2021
@cescoffier cescoffier merged commit d6ebbbf into smallrye:main Oct 11, 2021
@kdubb kdubb deleted the fix/rabbitmq_connector_races branch October 15, 2021 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working rabbitmq
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RabbitMQ connector unusable in Quarkus application
2 participants