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

provide API to close pooled connections #248

Closed
sjhiggs opened this issue May 9, 2024 · 3 comments · Fixed by #249
Closed

provide API to close pooled connections #248

sjhiggs opened this issue May 9, 2024 · 3 comments · Fixed by #249

Comments

@sjhiggs
Copy link

sjhiggs commented May 9, 2024

In some cases, it is desirable to force all the connections in the pool to close/re-open, e.g. when restarting a Camel route. This allows clients to re-balance when connecting to brokers in a cluster.

For example, in a clustered broker environment, sometimes broker restarts can cause clients to migrate to a small subset of the available brokers. A method to close the connections in the pool would allow the client to load balance across the full set of available brokers.

zhfeng added a commit to zhfeng/quarkus-pooled-jms that referenced this issue May 9, 2024
@zhfeng
Copy link
Contributor

zhfeng commented May 9, 2024

Hi @sjhiggs can you check with the PR

You can use the following codes in your application to clear all the connections. The new connection will be created in the next call to the connection pool.

@Inject
PooledJmsWrapper wrapper;

void clear() {
    wrapper.clearAll();
}

And make sure no connection has been used before call clear() method. All of the connections will be closed and removed from pool.

@sjhiggs
Copy link
Author

sjhiggs commented May 10, 2024

This works, thanks!

@zhfeng zhfeng linked a pull request May 11, 2024 that will close this issue
zhfeng added a commit that referenced this issue May 11, 2024
zhfeng added a commit that referenced this issue May 11, 2024
zhfeng added a commit that referenced this issue May 11, 2024
@zhfeng
Copy link
Contributor

zhfeng commented May 11, 2024

@sjhiggs I make there releases to add this feature.

  • 2.4.0 with the lastest Quarkus
  • 2.3.2 with the Quarkus 3.8
  • 2.1.2 with the Quarkus 3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants