-
Notifications
You must be signed in to change notification settings - Fork 144
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
Default connection timeout #132
Comments
Hi @spetz, Is it a common scenario that you broker does not respond? Do you start the application at the same time as you start the broker? I always run RabbitMQ Server as a service with autostart, so I never experienced this. Unfortunately, the connection attempt is performed in the constructor of the I'd like to keep this ticket open, as it is a rather easy fix that could be a part of the up-comming |
Thank you for the quick response @pardahlman. The case that I'm talking about is e.g. when I use the docker-compose for the local development and start the whole infrastructure at the same time. I've found some scripts that can wait till the database/service is ready, but still, I'd like to have such a timeout connection available as an additional parameter if possible :). |
Ok perfect! I'm looking at Polly for general error handling in version 2.0 👍 |
@pardahlman Are you wanting to add Polly to |
@ritasker - I like your implementation 👍. However, I am a bit hesitant to add Polly as a core dependency for RawRabbit. My plans, for 2.0 at least, is to move the Polly based error handling to its own NuGet package. I think it might be enough to just move the creation of the channel to its own, virtual method and implement a "poor mans" exception handling. This way it is easy to create a custom implementation and override the default implementation with a nice Polly based retry. Makes sense? |
@pardahlman My own preference would the same as yours, to move connection to a seperate virtual method that could be overriden in customer Slightly off-topic, but perhaps there could also be a toggle that gets passed into the |
@cocowalla - thanks for the input! I think that if we move the connect call to a virtual method, we could implement a |
Seems like a good way to approach this |
So that it can be overriden, error handled etc by custom implementations
@spetz - as discussed here, I've moved the connection to the broker to it's own virtual method
It should be fairly easy to derive from this class and add create your delayed Polly based retry strategy. |
Thank you for all of the answers guys, eventually, we did implement a similar solution and it works fine! :) |
Hi, when I start the application and the RabbitMQ is not ready yet (let's say it's starting and needs a few more seconds before the service is ready) the application immediately crashes due to the connection failure. I couldn't find an option to set a timeout when initializing the client - just like in the MongoDB.Driver where I can set e.g. 30 seconds timeout for the database connection. It seems that if the RabbitMQ service is not ready, the library will just crash after a second. Is there a way to change this behaviour?
The text was updated successfully, but these errors were encountered: