BewareMyPower opened a new issue, #292:
URL: https://github.com/apache/pulsar-client-cpp/issues/292

   ### Search before asking
   
   - [X] I searched in the 
[issues](https://github.com/apache/pulsar-client-cpp/issues) and found nothing 
similar.
   
   
   ### Version
   
   - OS: macOS 13.4
   - Pulsar: 3.0.0
   - Client: master (633f4bbe8c182128da09803172676b9d6af05057)
   - Clang++: 14.0.3
   
   ### Minimal reproduce step
   
   See 
https://github.com/BewareMyPower/pulsar-client-cpp-demo/blob/main/seek_close_loop.cc
   
   ```c++
     for (int i = 0; i < 100; i++) {
       Consumer consumer;
       if (auto result = client.subscribe(topic, "sub", conf, consumer);
           result != ResultOk) {
         LOG_ERROR(i << " Failed to subscribe: " << result);
         return 2;
       }
       if (auto result = consumer.receive(msg, 3000); result != ResultOk) {
         LOG_ERROR("Failed to receive: " << result);
         return 3;
       }
       LOG_INFO(i << " Received from " << msg.getMessageId());
       consumer.seekAsync(MessageId::earliest(), [](auto result) {
         LOG_INFO("Seek to earliest: " << result);
       });
       LOG_INFO(i << " Received from " << msg.getMessageId() << " after seek");
       if (auto result = consumer.close(); result != ResultOk) {
         LOG_ERROR("Failed to close: " << result);
       }
     }
   ```
   
   i.e. run a seek-close loop. Use `seekAsync` so that when `close` is called, 
the consumer is during seek.
   
   ### What did you expect to see?
   
   The application exits with 0.
   
   ### What did you see instead?
   
   The application exited with 2 that the 2nd time to subscribe failed with 
`ResultRetryable`.
   
   ```
   2023-06-27 15:33:18.865 ERROR [0x1e2c85e00] log_utils:30 | 1 Failed to 
subscribe: Retryable
   2023-06-27 15:33:18.865 INFO  [0x16d26f000] log_utils:39 | Seek to earliest: 
Ok
   ```
   
   ### Anything else?
   
   https://github.com/apache/pulsar/pull/7819 tried to fix this issue but it 
does not fix it.
   
   ### Are you willing to submit a PR?
   
   - [X] I'm willing to submit a PR!


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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to