Skip to content

Commit

Permalink
fix: Use nondurable cursors for pulsar readers
Browse files Browse the repository at this point in the history
By default we set subscriptions to use a durable cursor:
https://github.com/streamnative/pulsar-rs/blob/master/PulsarApi.proto#L352

We only run into this when durable is None which can also be avoided
if we use Pulsar::reader() which also sets durable to Some(false).

However, there are cases where users may call ConsumerBuilder::into_reader
without calling the Pulsar::reader() function first.
  • Loading branch information
omegaphoenix committed Aug 22, 2024
1 parent 5bb283a commit 2b91111
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/consumer/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ impl<Exe: Executor> ConsumerBuilder<Exe> {
// would this clone() consume too much memory?
let (mut config, mut joined_topics) = self.clone().validate::<T>().await?;

// Internally, the reader interface is implemented as a consumer using an exclusive, non-durable subscription
config.options.durable = Some(false);

// the validate() function defaults sub_type to SubType::Shared,
// but a reader's subscription is exclusive
warn!("Subscription Type for a reader is `Exclusive`. Resetting.");
Expand Down

0 comments on commit 2b91111

Please sign in to comment.