massakam commented on a change in pull request #200:
URL: https://github.com/apache/pulsar-client-node/pull/200#discussion_r825638693



##########
File path: src/Consumer.cc
##########
@@ -79,144 +81,131 @@ void MessageListener(pulsar_consumer_t *cConsumer, 
pulsar_message_t *cMessage, v
   listenerCallback->callback.Release();
 }
 
-void Consumer::SetCConsumer(std::shared_ptr<CConsumerWrapper> cConsumer) { 
this->wrapper = cConsumer; }
-void Consumer::SetListenerCallback(ListenerCallback *listener) {
+void Consumer::SetCConsumer(std::shared_ptr<pulsar_consumer_t> cConsumer) { 
this->cConsumer = cConsumer; }
+void Consumer::SetListenerCallback(MessageListenerCallback *listener) {
   if (listener) {
+    // Pass consumer as argument
+    listener->consumer = this;
+  }
+
+  if (this->listener == nullptr) {
     // Maintain reference to consumer, so it won't get garbage collected
     // since, when we have a listener, we don't have to maintain reference to 
consumer (in js code)
     this->Ref();

Review comment:
       I got it. If so, I think the comments above should be modified to match 
the code.
   
   > // Maintain reference to consumer, so it won't get garbage collected
   > // since, when we have a listener, we don't have to maintain reference to 
consumer (in js code)




-- 
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: dev-unsubscr...@pulsar.apache.org

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


Reply via email to