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

Support replicate_subscription_state option for consumer #313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,7 @@ pub(crate) mod messages {
.collect(),
read_compacted: Some(options.read_compacted.unwrap_or(false)),
initial_position: Some(options.initial_position.into()),
replicate_subscription_state: options.replicate_subscription_state,
schema: options.schema,
start_message_id: options.start_message_id,
..Default::default()
Expand Down
10 changes: 10 additions & 0 deletions src/consumer/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ pub struct ConsumerOptions {
/// }
/// ```
pub initial_position: InitialPosition,
/// Mark the subscription as "replicated". Pulsar will make sure
/// to periodically sync the state of replicated subscriptions
/// across different clusters (when using geo-replication).
pub replicate_subscription_state: Option<bool>,
}

impl ConsumerOptions {
Expand Down Expand Up @@ -76,4 +80,10 @@ impl ConsumerOptions {
self.initial_position = initial_position;
self
}

#[cfg_attr(feature = "telemetry", tracing::instrument(skip_all))]
pub fn with_replicate_subscription_state(mut self, replicate_subscription_state: bool) -> Self {
self.replicate_subscription_state = Some(replicate_subscription_state);
self
}
}