GitHub user pulsar-community-bot edited a discussion: Is there a way for the 
C++ Pulsar client to know whether it is connected to the server or not?

**Pulsar User**

Is there a way for the C++ Pulsar client to know whether it is connected to the 
server or not?

**David K**

Assuming the C++ client? When you use the client to create a consumer using one 
of the subscribe methods, you will get a 
[Result](https://pulsar.apache.org/api/cpp/3.1.x/namespacepulsar.html#ae85314d6b9e8afd831cf8c66705f2dbb)
 object back indicating the status. A `ResultOk` is success, the rest indicate 
some sort of connectivity issue, e.g. `ResultConnectError` or 
`ResultNotConnected`

FWIW, the same 
[Result](https://pulsar.apache.org/api/cpp/3.1.x/namespacepulsar.html#ae85314d6b9e8afd831cf8c66705f2dbb)
 object is returned from any of the `createProducer` calls as well.

**Pulsar User**

ok I will do some operation result to show if client is connected.

**David K**

But, the C++ and Python clients don’t have am `isClosed()` method like the java 
client does. Perhaps you can open a feature request for this?

GitHub link: https://github.com/apache/pulsar/discussions/19635

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to