diff --git a/nats/js/client.py b/nats/js/client.py index e5b24634..0ab1a111 100644 --- a/nats/js/client.py +++ b/nats/js/client.py @@ -415,9 +415,10 @@ async def main(): if stream is None: stream = await self._jsm.find_stream_name_by_subject(subject) + consumer_config: api.ConsumerConfig | None = None try: # TODO: Detect configuration drift with the consumer. - await self._jsm.consumer_info(stream, durable) + consumer_config = await self._jsm.consumer_info(stream, durable) except nats.js.errors.NotFoundError: # If not found then attempt to create with the defaults. if config is None: @@ -427,6 +428,9 @@ async def main(): config.durable_name = durable await self._jsm.add_consumer(stream, config=config) + if consumer_config and config: + await self._jsm.add_consumer(stream, config=config) + return await self.pull_subscribe_bind( durable=durable, stream=stream,