fayce66 edited a comment on issue #9317:
URL: https://github.com/apache/pulsar/issues/9317#issuecomment-768657251


   it still does not work for me, I tried to simplify my code to get closer to 
your example and I even hard-coded the partition key, but it still does not 
work. I run the producer for 1 or 2 mins to produce few messages then I launch 
the consumer expecting only the last message but I get:
   
   ```
   PM|9827|9839|09:47:07.429047|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429175|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429206|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429228|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429256|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429277|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429296|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   PM|9827|9839|09:47:07.429322|INFO|[pm.calib.sub]: new message from 
[stsd.local] on topic [persistent://xyz/foo/calib]: partition key:[test_key]
   ```
   Also, if I stop the producer and let the consumer receive all the messages, 
then restart just the consumer with the same subscription to receive the last 
message with the partition key = 'test_key', I get no messages at all, like I 
would for a subscription with no topic compaction...(btw, you are using  
conf.setSubscriptionInitialPosition(InitialPositionEarliest); does that mean 
that for topic compaction subscription, it's absolutely necessary to set this 
configuration to receive the last message of my partition key?)
   
   Did you use a newer version of pulsar than 2.7.0? This is the version that I 
am using now.
   
   I noticed that you are using:  `result = producer.send(msg, id);` which does 
not exist in pulsar c++ 2.7.0
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to