Skip to content

Commit b4a0f07

Browse files
author
Andrei Neagu
committed
repalced warning with error
1 parent c09126d commit b4a0f07

File tree

1 file changed

+7
-11
lines changed
  • packages/service-library/src/servicelib/rabbitmq

1 file changed

+7
-11
lines changed

packages/service-library/src/servicelib/rabbitmq/_utils.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,18 @@ async def declare_queue(
8585
# NOTE: setting a name will ensure multiple instance will take their data here
8686
queue_parameters |= {"name": queue_name}
8787

88-
# avoids deprecated `transient_nonexcl_queues` warning
89-
# TODO: raise an error here to avoid this configuration
88+
# avoids deprecated `transient_nonexcl_queues` warning in RabbitMQ
9089
if (
9190
queue_parameters.get("durable", False) is False
9291
and queue_parameters.get("exclusive", False) is False
9392
):
94-
_logger.warning(
95-
"Avoid `transient_nonexcl_queues` warning for queue_setup: %s",
96-
queue_parameters,
93+
msg = (
94+
"Queue must be `durable` or `exclusive`, but not both. "
95+
"This is to avoid the `transient_nonexcl_queues` warning. "
96+
"NOTE: if both `durable` and `exclusive` are missing they are considered False. "
97+
f"{queue_parameters=}"
9798
)
98-
# this is the closes equivalen of the old `transient_nonexcl_queues`
99-
# without violating the deprecation warning
100-
# https://github.com/rabbitmq/rabbitmq-server/discussions/13161
101-
queue_parameters["durable"] = True
102-
queue_parameters["message-ttl"] = 86400000 # 24 hours
103-
_logger.warning("NEW params: %s", queue_parameters)
99+
raise ValueError(msg)
104100

105101
# NOTE: if below line raises something similar to ``ChannelPreconditionFailed: PRECONDITION_FAILED``
106102
# most likely someone changed the signature of the queues (parameters etc...)

0 commit comments

Comments
 (0)