gperinazzo commented on issue #56: Add listener support for consumer
URL: https://github.com/apache/pulsar-client-node/pull/56#issuecomment-547734374
 
 
   > I can receive only one message when ack(message) doesn’t be called.
   
   Yes, that is a problem I had to put in since the pulsar client expects the 
message listener to be synchronous. The consumer pointer it passes into the C 
callback is only valid until the function returns, so I can't allow the ack 
function to hold a reference to it after it ends.
   
   Currently, I'll wait until either the ack function gets garbage collected or 
ack is called. So you do eventually get all messages, it's just that if you 
don't call it, you'll have to wait until all ack is garbage collected for every 
message (and that is pretty slow).
   
   I checked how the Go library deals with this and it seems that it just leaks 
a bit of memory in order to pass the original consumer pointer into the message 
listener. I don't know if that would be acceptable. I added a third argument 
recently due to this, it just releases the message listener callback without 
acking the message in order to implement a timeout.
   
   Any help in solving this issue without that downside is welcome. One option 
is to try to pass the original consumer pointer into the callback, but I could 
not find a way to free the memory after.
   
   > retest this please
   
   I'll update the test dockerfile to install node 12 over the weekend. That 
should clear the CI issues.
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to