Repository navigation
fix: Bug: robust_queue.bind on an expiring queue causes channel not found on ... - #3262
Closed
Roshan931 wants to merge 1 commit into
Conversation
Signed-off-by: Robert Markovski <5818108+Roshan931@users.noreply.github.com>
|
|
Collaborator
|
Hi. I’m forced to close your Pull Request.
My MRE. import asyncio
import aio_pika
from faststream.rabbit import ExchangeType, RabbitBroker
from faststream.rabbit.schemas import RabbitQueue, RabbitExchange
from faststream.rabbit.schemas.queue import ClassicQueueArgs
async def main():
broker = RabbitBroker("amqp://guest:guest@localhost:5672/")
exchange = RabbitExchange(
name="amq.topic",
type=ExchangeType.TOPIC,
durable=True,
)
routing_key = "test.key"
delay = 5 # seconds
delay_queue = RabbitQueue(
name=f"test.delay.{delay}",
routing_key=f"{routing_key}.dlx.{delay}",
durable=True,
arguments=ClassicQueueArgs(
{
"x-dead-letter-exchange": exchange.name,
"x-dead-letter-routing-key": routing_key,
"x-message-ttl": delay * 1000,
"x-expires": delay * 1000,
}
),
)
final_queue = RabbitQueue(
name="test.final",
routing_key=routing_key,
durable=True,
)
async with broker:
await broker.declare_exchange(exchange)
dq = await broker.declare_queue(delay_queue)
fq = await broker.declare_queue(final_queue)
await dq.bind(
aio_pika.Exchange(
dq.channel,
name="amq.topic",
type=ExchangeType.TOPIC,
durable=True,
),
routing_key=f"{routing_key}.dlx.{delay}",
)
await fq.bind(
aio_pika.Exchange(
fq.channel,
name="amq.topic",
type=ExchangeType.TOPIC,
durable=True,
),
routing_key=routing_key,
)
# publish message → should land in delay queue first,
# then be dead-lettered to final queue after TTL
await broker.publish(
message={"hello": "world"},
exchange=exchange.name,
routing_key=f"{routing_key}.dlx.{delay}",
)
if __name__ == "__main__":
asyncio.run(main()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2721
Root cause
RabbitDeclarer caches queues the broker can delete (x-expires / auto_delete)
Changes