From 3de333a6bad986030fe207b7d9fd4b1b6ec5896f Mon Sep 17 00:00:00 2001 From: "chandr-andr (Kiselev Aleksandr)" Date: Wed, 11 Oct 2023 23:08:59 +0200 Subject: [PATCH 1/2] Edit PullSubscription config if config was passed in method. Signed-off-by: chandr-andr (Kiselev Aleksandr) --- nats/js/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nats/js/client.py b/nats/js/client.py index e5b24634..3c99d5b3 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: @@ -426,6 +427,9 @@ async def main(): config.filter_subject = subject 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, From a9e2c41280352fe384f404acddc956b1b6510ce9 Mon Sep 17 00:00:00 2001 From: "chandr-andr (Kiselev Aleksandr)" Date: Wed, 11 Oct 2023 23:27:52 +0200 Subject: [PATCH 2/2] Removed whitespace Signed-off-by: chandr-andr (Kiselev Aleksandr) --- nats/js/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nats/js/client.py b/nats/js/client.py index 3c99d5b3..0ab1a111 100644 --- a/nats/js/client.py +++ b/nats/js/client.py @@ -427,7 +427,7 @@ async def main(): config.filter_subject = subject 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)