fix(nats): delete old push consumer before creating pull consumer
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m10s
test / unit (pull_request) Failing after 10m54s
test / integration (pull_request) Failing after 17m11s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 9m10s
test / unit (pull_request) Failing after 10m54s
test / integration (pull_request) Failing after 17m11s
This commit is contained in:
@@ -113,6 +113,17 @@ impl MessageSource for NatsMessageSource {
|
||||
}
|
||||
};
|
||||
|
||||
// Delete any existing push consumer with this name — can't reuse as pull.
|
||||
// No-op if it doesn't exist or is already a pull consumer.
|
||||
if let Ok(info) = stream.consumer_info(CONSUMER_NAME).await {
|
||||
if info.config.deliver_subject.is_some() {
|
||||
tracing::info!(
|
||||
"deleting old push consumer '{CONSUMER_NAME}', replacing with pull"
|
||||
);
|
||||
let _ = stream.delete_consumer(CONSUMER_NAME).await;
|
||||
}
|
||||
}
|
||||
|
||||
let consumer = match stream
|
||||
.get_or_create_consumer(
|
||||
CONSUMER_NAME,
|
||||
|
||||
Reference in New Issue
Block a user