Skip to content
New issue

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

Reading the latest message? #315

Open
otobrglez opened this issue Jul 22, 2024 · 0 comments
Open

Reading the latest message? #315

otobrglez opened this issue Jul 22, 2024 · 0 comments

Comments

@otobrglez
Copy link

otobrglez commented Jul 22, 2024

Hey!

I would love to use pulsar-rs for one of our projects. However, I'm having trouble reading the "last message" for the Pulsar topic given.

Can I please get some pointers on how to do that? In the Java/Scala version, I was able to do it by setting the startMessageId to MessageId.latest:

val reader = pulsarClient
  .newReader(Schema.BYTES)
  .topic(topic)
  .startMessageIdInclusive()
  .startMessageId(MessageId.latest) // This could be set to "MessageId.latest"
  .subscriptionName(subscriptionName)
  .readCompacted(readCompacted)
  .create()

However, with pulsar-rs, I'm a bit lost...

let builder = pulsar.reader()
    .with_topic(&self.topic)
    .with_subscription_type(SubType::Exclusive)
    .with_subscription("dodo-x")
    .with_start_message_id(?) // ??? - this also does not exists?
    .with_options(ConsumerOptions::default()
        // with_start_message_id ??? - this does not exist?
        .with_initial_position(InitialPosition::Latest)
        .durable(false)
        .read_compacted(false)
    );

Any pointer on this subject would be highly appreciated. Regards, and have a lovely day!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant