You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/21 15:51:39 UTC

[GitHub] [pulsar] metahys opened a new pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

metahys opened a new pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118


   <!--
   ### Contribution Checklist
     
     - Name the pull request in the form "[Issue XYZ][component] Title of the pull request", where *XYZ* should be replaced by the actual issue number.
       Skip *Issue XYZ* if there is no associated github issue for this pull request.
       Skip *component* if you are unsure about which is the best component. E.g. `[docs] Fix typo in produce method`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   Fixes #1240 
   
   ### Motivation
   
   This PR supports setting `ConsumerEventListener` in pulsar cpp client. 
   
   ### Modifications
   
   - add an abstract class `ConsumerEventListener` for listening consumer events.
   - add `setConsumerEventListener` and `getConsumerEventListener` methods in `ConsumerConfiguration`
   - add `handleActiveConsumerChange` method in `ClientConnection` to handle the `ACTIVE_CONSUMER_CHANGE` event.
   
   ### Verifying this change
   
   -  Added unit test in `ConsumerConfigurationTest`
   
   ### Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (no)
     - The public API: (no)
     - The schema: (no)
     - The default values of configurations: (no)
     - The wire protocol: (no)
     - The rest endpoints: (no)
     - The admin cli options: (no)
     - Anything that affects deployment: (no)
   
   ### Documentation
   
   - no-need-doc 
   
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] merlimat merged pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

Posted by GitBox <gi...@apache.org>.
merlimat merged pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] metahys commented on a change in pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

Posted by GitBox <gi...@apache.org>.
metahys commented on a change in pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118#discussion_r715452313



##########
File path: pulsar-client-cpp/tests/ConsumerConfigurationTest.cc
##########
@@ -28,11 +28,19 @@ DECLARE_LOG_OBJECT()
 
 using namespace pulsar;
 
+class DummyEventListener : public ConsumerEventListener {
+   public:
+    virtual void becomeActive(Consumer consumer, int partitionId) override {}

Review comment:
       I have added unit tests in `ConsumerTest`. And I renamed "become" to "became" to make it consistent with java client. The call to `registerConsumer` is moved from `handleCreateConsumer` to `connectionOpened`, so that we can handle commands such as `ACTIVE_CONSUMER_CHANGE` properly.
   
   @merlimat Please take a look.
   
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] metahys commented on pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

Posted by GitBox <gi...@apache.org>.
metahys commented on pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118#issuecomment-924528448


   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] metahys commented on pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

Posted by GitBox <gi...@apache.org>.
metahys commented on pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118#issuecomment-924555334


   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] metahys removed a comment on pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

Posted by GitBox <gi...@apache.org>.
metahys removed a comment on pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118#issuecomment-924528448


   /pulsarbot run-failure-checks


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] merlimat commented on a change in pull request #12118: [Issue 1240][C++] Support setting ConsumerEventListener in pulsar cpp client

Posted by GitBox <gi...@apache.org>.
merlimat commented on a change in pull request #12118:
URL: https://github.com/apache/pulsar/pull/12118#discussion_r714428482



##########
File path: pulsar-client-cpp/tests/ConsumerConfigurationTest.cc
##########
@@ -28,11 +28,19 @@ DECLARE_LOG_OBJECT()
 
 using namespace pulsar;
 
+class DummyEventListener : public ConsumerEventListener {
+   public:
+    virtual void becomeActive(Consumer consumer, int partitionId) override {}

Review comment:
       We should add a test that verifies that the active/inactive tests are being invoked. We can follow the same line of test that we're doing for java




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org