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

Change default value for Durable flag on Queue creation for pidbox (RabbitMQ deprecated feature transient_nonexcl_queues) #2237

Open
Osmoskour opened this issue Jan 28, 2025 · 3 comments

Comments

@Osmoskour
Copy link

In 4.0, RabbitMQ added transient_nonexcl_queues to deprecated features:
https://www.rabbitmq.com/release-information/deprecated-features-list
https://www.rabbitmq.com/blog/2021/08/21/4.0-deprecation-announcements#removal-of-transient-non-exclusive-queues

rabbitmq  | 2025-01-27 09:40:55.277393+00:00 [warning] <0.780.0> Deprecated features: `transient_nonexcl_queues`: Feature `transient_nonexcl_queues` is deprecated.
rabbitmq  | 2025-01-27 09:40:55.277393+00:00 [warning] <0.780.0> By default, this feature can still be used for now.
rabbitmq  | 2025-01-27 09:40:55.277393+00:00 [warning] <0.780.0> Its use will not be permitted by default in a future minor RabbitMQ version and the feature will be removed from a future major RabbitMQ version; actual versions to be determined.

By default, the durable flag for new queue is False. This is hardcoded for pidbox.py:

kombu/kombu/pidbox.py

Lines 395 to 405 in a0175b0

def _get_exchange(self, namespace, type):
return Exchange(self.exchange_fmt % namespace,
type=type,
durable=False,
delivery_mode='transient')
def _get_reply_exchange(self, namespace):
return Exchange(self.reply_exchange_fmt % namespace,
type='direct',
durable=False,
delivery_mode='transient')

kombu/kombu/pidbox.py

Lines 233 to 257 in a0175b0

def get_reply_queue(self):
oid = self.oid
return Queue(
f'{oid}.{self.reply_exchange.name}',
exchange=self.reply_exchange,
routing_key=oid,
durable=False,
auto_delete=True,
expires=self.reply_queue_expires,
message_ttl=self.reply_queue_ttl,
)
@cached_property
def reply_queue(self):
return self.get_reply_queue()
def get_queue(self, hostname):
return Queue(
f'{hostname}.{self.namespace}.pidbox',
exchange=self.exchange,
durable=False,
auto_delete=True,
expires=self.queue_expires,
message_ttl=self.queue_ttl,
)

kombu/kombu/pidbox.py

Lines 272 to 274 in a0175b0

exchange = Exchange(exchange, exchange_type='direct',
delivery_mode='transient',
durable=False)

And not hardcoded for qpid.py but setting it to True can be a sensible default:

def queue_declare(self, queue, passive=False, durable=False,

def exchange_declare(self, exchange='', type='direct', durable=False,

By setting those to True, can we avoid the deprecated feature warning?

@bfdacosta
Copy link

Greetings. Have the same issue in my env.
bump!

@trevorboydsmith
Copy link

trevorboydsmith commented Mar 26, 2025

TLDR: i concur with this solution. (FYI "transient_nonexcl_queues" feature has been soft deprecated since 2021 https://www.rabbitmq.com/release-information/deprecated-features-list)

further analysis (see below):

the software requirements from my point of view are:

  1. change celery/kombu to not depend on a rabbitmq feature that will be removed
  2. keep the celery functionality the same (i.e. celery inspect/control/ping via pidbox)

the proposed change fulfills both of the software requirements by:

  1. changing default durable to True
  2. keeps the celery functionality all the same

the only downside is that all celery inspect/control/ping command/control is done via queues that are durable instead of in-memory so there is a slight performance hit (not a big deal IMO). and the change is very low risk.

p.s. IMO it does not require a new celery config field/parameter because the rabbitmq feature is going away so no way to turn back on once it goes away.

@auvipy
Copy link
Member

auvipy commented Mar 27, 2025

thanks for the report. we will consider this for kombu 5.7. anyone is welcome to contribute. if not we will try to handle them by ourselves.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants