Skip to content

Commit a4012e8

Browse files
authored
fix: Use nondurable cursors for pulsar readers (streamnative#324)
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 overwrite the options before calling `into_reader()`.
1 parent 5bb283a commit a4012e8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/consumer/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ impl<Exe: Executor> ConsumerBuilder<Exe> {
324324
// would this clone() consume too much memory?
325325
let (mut config, mut joined_topics) = self.clone().validate::<T>().await?;
326326

327+
// Internally, the reader interface is implemented as a consumer using an exclusive,
328+
// non-durable subscription
329+
config.options.durable = Some(false);
330+
327331
// the validate() function defaults sub_type to SubType::Shared,
328332
// but a reader's subscription is exclusive
329333
warn!("Subscription Type for a reader is `Exclusive`. Resetting.");

0 commit comments

Comments
 (0)