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

Heartbeat support? #50

Open
emk opened this issue Dec 15, 2016 · 3 comments · May be fixed by #66
Open

Heartbeat support? #50

emk opened this issue Dec 15, 2016 · 3 comments · May be fixed by #66

Comments

@emk
Copy link

emk commented Dec 15, 2016

Thank you for writing a great AMQP library for Rust!

I'm using this library at work, and I've run into a use-case where it would really help to have AMQP heartbeat support. Do you have any suggestions about how heartbeat support could be implemented, and where to start? Thank you for any pointers you can provide!

@Antti
Copy link
Owner

Antti commented Dec 16, 2016

Hi @emk , I'm glad to hear that you find this library useful.

Heartbeat is indeed one of the missing features. It should not be that hard to implement.

  1. Make heartbeat/heartbeat interval a configuration option.
  2. Negotiate heartbeat interval with server's Tune request and send interval along with a connection::TuneOk frame.
  3. If negotiated interval is > 0, then we need to start sending heartbeats on channel 0. I guess we should start a new thread, which will do this in the specified intervals. It is only necessary to send heartbeats if there was no traffic sent through the connection during the heartbeat interval.
  4. Receive heartbeats (they should come on channel 0), and reset a heartbeat received timer. In the heartbeat thread check if heartbeat timer exceeds the heartbeat interval * 2, if so, then just close the connection (without connection.close). Somehow notify consumers/producers (?).

More information available AMQP Spec, page 36-37.

@thedodd
Copy link

thedodd commented Feb 1, 2018

Definitely an awesome library so far. Heartbeat support would be a great feature to implement, no doubt. I'll see if I can get around to opening a PR for this ASAP.

@thedodd thedodd linked a pull request Feb 1, 2018 that will close this issue
5 tasks
@thedodd
Copy link

thedodd commented Feb 1, 2018

Ok, opened up initial PR on getting this in order. I am giving it some practical testing now.

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.

3 participants