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

RawRabbit Connection #297

Closed
ma7ammad opened this issue Dec 14, 2017 · 5 comments
Closed

RawRabbit Connection #297

ma7ammad opened this issue Dec 14, 2017 · 5 comments

Comments

@ma7ammad
Copy link

Hi,

  1. I want to first check if RawRabbit is alive when i start the app, otherwise the app should stop.
  2. If RawRabbit was connected at app-startup but failed thereafter i want to stop the app.

I have searched the docs but could not find much.
Is there anyway to check whether RawRabbit is connecting/running?

Thanks.

@pardahlman
Copy link
Owner

Hello, @ma7ammad - thanks for reaching out. I have a few follow up questions for you:

  • Are you using the 1.x or 2.x version of the client?
  • What do you mean with "check if RawRabbit is alive"?

@ma7ammad
Copy link
Author

@pardahlman ,

  1. I am using RawRabbit v.2.x.
  2. "check if RawRabbit is alive": Example: at the moment RawRabbit is run from a docker container. Sometimes RawRabbit is down (container is stopped) and when a RawRabbit-call is made a ConnectFailureException is thrown.

I am looking for a way, to check at the startup of the app and during the the time that the app is running, to tell if RawRabbit stops (at any moment) so i can stop the app.

@pardahlman
Copy link
Owner

Hello again. Do you mean that the RabbitMQ broker is hosted in a docker container?

If you want to solve the problem of connect retry when the broker is down, then perhaps the Polly enricher might solve this issue, especially as it has support for declaring retry policies for the channel factory.

@ma7ammad
Copy link
Author

ma7ammad commented Dec 18, 2017

Hi,
No it is not that.
I am not looking to solve a connection problem but i am looking for a way to tell if there is a problem -regardless of the cause- which is bringing RawRabbit down.
The app which is using RawRabbit should not work if RawRabbit is down; it should be stopped (Environment.Exit(1)).

@pardahlman
Copy link
Owner

I think what confuses me is what you mean with "RawRabbit" in this context:

The app which is using RawRabbit should not work if RawRabbit is down

Do you mean that the client application using RawRabbit should not work if the RabbitMQ broker is not responding? If that's the case, you could try to setup a subscription or publish a message and see if you get an exception.

Another option would be to replace the default IChannelPoolFactory with the StaticChannelPool and resolve the IChannelFactory to create a few channels. This will definitely throw as soon as the IBusClient is being resolved.

Yet another option, if you have activated the management plugin in RabbitMQ would be to use it's RESTful API (which only responds if the broker is reachable).

Hope this helps!

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