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

Detect network issue or no message scenario #271

Open
rajdippatel-emc opened this issue Feb 26, 2021 · 1 comment
Open

Detect network issue or no message scenario #271

rajdippatel-emc opened this issue Feb 26, 2021 · 1 comment

Comments

@rajdippatel-emc
Copy link

rajdippatel-emc commented Feb 26, 2021

Hello,

I want to know correct way to detect network issues while polling messages from consumer. I noticed that when network had issue consumer keeps returning null message. Also when there is no message on server side, it is returning null message too. So it is not possible whether it is network issue or no message. I have following code.

while (true) {
    Message msg = consumer.poll();

    if (!msg) {
        ** This condition is executed when there is no message or network has issues**
        continue;
    }

    if (msg.get_error()) {
        if (!msg.is_eof()) {
        }
        continue;
    }

    cout << "Received message" << msg.get_payload() << endl;
}
@rajdippatel-emc rajdippatel-emc changed the title Detect network issue Detect network issue or no message scenario Feb 26, 2021
@accelerated
Copy link
Contributor

You can get network errors via the error callback IIRC

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