-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client #11535
[Issue 11493] Fix #11493. Simple implementation of getting number of references from C++ client #11535
Conversation
There are two questions:
|
I think it should be counted as multiple references. For example, if you created a producer of a 3 partitions topic, there're actually 3 TCP connections.
|
@Sunny-Island you can take this as references when adding docs. |
@Anonymitaet I changed the label from doc-required to no-need-doc because the documents are already added to the C++ header so that the related documents will be generated by Doxygen. |
@BewareMyPower many thanks for providing doc info! Since this PR modifies docs (it adds some descriptions in |
…rom C++ client (#11535) Fixes #11493 Master Issue: #11493 ### Motivation In Pulsar, we use a single client to create multiple producers/consumers/readers. Is there any method/attribute that can give information on number of producers/readers/consumers connected to the given pulsar client instance at the given point of time? Say there is a single pulsar client instance. Multiple consumers and readers are created from the given client instance. This client needs to be cleaned up when all the references are closed. In this case, it would be of help, to get information on the number of the consumers/readers/ getPartitionsForTopic calls are active on the given client. Ie, having the number of references for the given client can provide information on whether it is fine to clean up the client instance at the given point of time. *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Add these method to `Client.h`, `Client.cc`, `ClientImpl.h`, `CliemtImpl.cc` : ``` uint64_t getNumberOfProducer() uint64_t getNumberOfConsumer() ``` To count alive producers, I get each producer by weak point and check if it is connected. ### Verifying this change This change added tests and can be verified as follows: Add unit test to check if these functions can return correct references number. Test file is `ClientTest.cc`. Test function is `TEST(ClientTest, testGetNumberOfReferences)`. (cherry picked from commit e6909c6)
…rom C++ client (apache#11535) Fixes apache#11493 Master Issue: apache#11493 ### Motivation In Pulsar, we use a single client to create multiple producers/consumers/readers. Is there any method/attribute that can give information on number of producers/readers/consumers connected to the given pulsar client instance at the given point of time? Say there is a single pulsar client instance. Multiple consumers and readers are created from the given client instance. This client needs to be cleaned up when all the references are closed. In this case, it would be of help, to get information on the number of the consumers/readers/ getPartitionsForTopic calls are active on the given client. Ie, having the number of references for the given client can provide information on whether it is fine to clean up the client instance at the given point of time. *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Add these method to `Client.h`, `Client.cc`, `ClientImpl.h`, `CliemtImpl.cc` : ``` uint64_t getNumberOfProducer() uint64_t getNumberOfConsumer() ``` To count alive producers, I get each producer by weak point and check if it is connected. ### Verifying this change This change added tests and can be verified as follows: Add unit test to check if these functions can return correct references number. Test file is `ClientTest.cc`. Test function is `TEST(ClientTest, testGetNumberOfReferences)`.
…rom C++ client (apache#11535) Fixes apache#11493 Master Issue: apache#11493 ### Motivation In Pulsar, we use a single client to create multiple producers/consumers/readers. Is there any method/attribute that can give information on number of producers/readers/consumers connected to the given pulsar client instance at the given point of time? Say there is a single pulsar client instance. Multiple consumers and readers are created from the given client instance. This client needs to be cleaned up when all the references are closed. In this case, it would be of help, to get information on the number of the consumers/readers/ getPartitionsForTopic calls are active on the given client. Ie, having the number of references for the given client can provide information on whether it is fine to clean up the client instance at the given point of time. *Explain here the context, and why you're making that change. What is the problem you're trying to solve.* ### Modifications Add these method to `Client.h`, `Client.cc`, `ClientImpl.h`, `CliemtImpl.cc` : ``` uint64_t getNumberOfProducer() uint64_t getNumberOfConsumer() ``` To count alive producers, I get each producer by weak point and check if it is connected. ### Verifying this change This change added tests and can be verified as follows: Add unit test to check if these functions can return correct references number. Test file is `ClientTest.cc`. Test function is `TEST(ClientTest, testGetNumberOfReferences)`.
Fixes #11493
Master Issue: #11493
Motivation
In Pulsar, we use a single client to create multiple producers/consumers/readers. Is there any method/attribute that can give information on number of producers/readers/consumers connected to the given pulsar client instance at the given point of time?
Say there is a single pulsar client instance. Multiple consumers and readers are created from the given client instance. This client needs to be cleaned up when all the references are closed. In this case, it would be of help, to get information on the number of the consumers/readers/ getPartitionsForTopic calls are active on the given client. Ie, having the number of references for the given client can provide information on whether it is fine to clean up the client instance at the given point of time.
Explain here the context, and why you're making that change. What is the problem you're trying to solve.
Modifications
Add these method to
Client.h
,Client.cc
,ClientImpl.h
,CliemtImpl.cc
:To count alive producers, I get each producer by weak point and check if it is connected.
Verifying this change
This change added tests and can be verified as follows:
Add unit test to check if these functions can return correct references number. Test file is
ClientTest.cc
. Test function isTEST(ClientTest, testGetNumberOfReferences)
.Documentation
For this PR, do we need to update docs?
I will add doc to C++ client part in follow-up issue.