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

Consumer notification of disconnect #2

Closed
fpagliughi opened this issue Jan 2, 2018 · 1 comment
Closed

Consumer notification of disconnect #2

fpagliughi opened this issue Jan 2, 2018 · 1 comment
Milestone

Comments

@fpagliughi
Copy link
Contributor

Currently the consumer channel is not notified if the client loses connection to the broker. The client might be left hanging if a disconnect occurs.

let rx = cli.start_consuming();
for msg in rx.iter() {
    // This should break on a disconnect
}
// The client can reconnect here
@fpagliughi fpagliughi added this to the v1.0 milestone Jan 2, 2018
fpagliughi added a commit that referenced this issue Jan 3, 2018
…a None value indicates a problem such as a client disconnection.

Updated sync_consumer example to detect disconnect and try to reconnect.
@fpagliughi
Copy link
Contributor Author

The message callback now passes an Option instead of just a message. None is sent if there's a problem with the client, such as it being disconnected. The channel is kept open, and after the problem is resolved, the application can just keep reading from it.

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

1 participant