streamnative / pulsar-rs

Rust Client library for Apache Pulsar
Other
369 stars 121 forks source link

fix: Use nondurable cursors for pulsar readers #324

Closed omegaphoenix closed 3 months ago

omegaphoenix commented 3 months ago

From the Apache Pulsar documentation:

Internally, the reader interface is implemented as a consumer using an exclusive, non-durable subscription to the topic with a randomly-allocated name.

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().

omegaphoenix commented 3 months ago

Screenshot 2024-08-22 at 4 57 52 PM An example of how we could shoot ourselves in the foot without this change