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 test if connection is currently failing? #47

Closed
spilliton opened this issue Jul 2, 2012 · 5 comments
Closed

How to test if connection is currently failing? #47

spilliton opened this issue Jul 2, 2012 · 5 comments

Comments

@spilliton
Copy link

Hello,

I'm needing to implement some logic to occur when our stomp client is unable to connect to our message server.

I was trying to use client.open?. This returned true just fine, but when I killed my message server to test the failure condition, it continued to report true, even though 'on_connectfail' log messages were being logged.

After checking out the socket method in connection.rb, It looks like I might be able to check @connection_attempts > 0 but was wondering if there is a better way, or if maybe I'm going about this all wrong...

Thanks!

@gmallard
Copy link

gmallard commented Jul 3, 2012

Please show me your call to Client#new or Client#open.

Right now, I do not think you are doing anything wrong.......

Regards.

@gmallard
Copy link

gmallard commented Jul 3, 2012

Do you have a small example program that displays this behavior? If so, please post it here.

Thanks.

@gmallard
Copy link

gmallard commented Jul 3, 2012

You are making the argument that the instance variable @closed should be set to true during retries for a failing connection, and then set to false again when a reconnect occurs.

I agree. Accepted. It is a one line code change, and will be in the next release.

Regards, Guy

@gmallard
Copy link

gmallard commented Jul 3, 2012

Closed: 270512b

@gmallard gmallard closed this as completed Jul 3, 2012
@spilliton
Copy link
Author

That is it exactly. Thanks for jumping on this so quick!

I was gonna try and repro in a unit test on the gem, but had some other stuff come up this morning.

Thanks!

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