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

How to close Connection from org.springframework.amqp.rabbit.connection.CachingConnectionFactory #609

Closed
NargiT opened this issue Apr 28, 2017 · 2 comments

Comments

@NargiT
Copy link

NargiT commented Apr 28, 2017

Hello,

I'm using spring-amqp with spring-rabbit in a batch. I used <rabbit:connection-factory ... /> in my context in order to declare my ConnectionFactory and all the rest.

When my application is on the way to end, a connection remain active and blocks the process to finish. I read the .close() has not effect on this connection factory and I would like to know what should I do in order to gracefully end it ?

Thx

@garyrussell
Copy link
Contributor

garyrussell commented Apr 28, 2017

Please don't use GitHub issues for questions; use Stack Overflow instead (spring-amqp tag) - GitHub issues are for bugs and feature requests.

If the connection factory is declared in the application context, it's destroy() method will automatically be called when the application context is closed or destroyed.

If you are using a user-created factory (outside of the Spring application context) you can call destroy() or resetConnection() on it.

@NargiT
Copy link
Author

NargiT commented Apr 30, 2017

to bad that we cannot use it explicitly.

I found a solution closing manually the spring context (i'm using a custom start up code)

thx !

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

No branches or pull requests

2 participants