We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client 3.5.0
Create a main.cc
main.cc
#include <chrono> #include <pulsar/Client.h> using namespace pulsar; int main(int argc, char *argv[]) { Client client{"pulsar://localhost:6650"}; std::string topic = (argc > 1) ? argv[1] : "my-topic"; Producer producer; if (auto result = client.createProducer(topic, producer); result != ResultOk) { std::cerr << "Failed to create producer: " << result << std::endl; return 1; } producer.send(MessageBuilder().setContent("msg-0").build()); Reader reader; if (auto result = client.createReader(topic, MessageId::latest(), {}, reader); result != ResultOk) { std::cerr << "Failed to create reader: " << result << std::endl; return 2; } using namespace std::chrono; reader.seek( duration_cast<milliseconds>(system_clock::now().time_since_epoch()) .count()); bool hasMessage; if (auto result = reader.hasMessageAvailable(hasMessage); result != ResultOk) { std::cerr << "hasMessageAvailable failed: " << result << std::endl; return 3; } std::cout << hasMessage << std::endl; return 0; }
Key point: the start position must be latest for Reader.
latest
Reader
On macOS m1, install the the macos-arm64.zip and build with those artifacts.
curl -O -L https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.5.0/macos-arm64.zip unzip -q macos-arm64.zip g++ main.cc -std=c++17 -I ./include -L ./lib -Wl,-rpath ./lib -lpulsar ./a.out
Outputs (ignore the outputs from the library):
1
The output should be 0 like the behavior with 3.4.2
curl -O -L https://archive.apache.org/dist/pulsar/pulsar-client-cpp-3.4.2/macos-arm64.zip unzip -q macos-arm64.zip g++ main.cc -std=c++17 -I ./include -L ./lib -Wl,-rpath ./lib -lpulsar ./a.out
Outputs:
0
No response
The text was updated successfully, but these errors were encountered:
Fix wrong results of hasMessageAvailable and readNext after seeking b…
04d2210
…y timestamp Fixes apache#420 It's a catch-up for apache/pulsar#22363
27d8cc0
…y timestamp (#422) Fixes #420 It's a catch-up for apache/pulsar#22363
b2ad352
…y timestamp (#422) Fixes #420 It's a catch-up for apache/pulsar#22363 (cherry picked from commit 27d8cc0)
Successfully merging a pull request may close this issue.
Search before asking
Version
Client 3.5.0
Minimal reproduce step
Create a
main.cc
Key point: the start position must be
latest
forReader
.On macOS m1, install the the macos-arm64.zip and build with those artifacts.
What did you expect to see?
Outputs (ignore the outputs from the library):
What did you see instead?
The output should be 0 like the behavior with 3.4.2
Outputs:
Anything else?
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: