Skip to content

Support AioPikaBroker's declare_queues_kwargs['arguments'] parameter #41

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
WiZeYAR opened this issue May 20, 2025 · 0 comments · May be fixed by #42
Open

Support AioPikaBroker's declare_queues_kwargs['arguments'] parameter #41

WiZeYAR opened this issue May 20, 2025 · 0 comments · May be fixed by #42

Comments

@WiZeYAR
Copy link

WiZeYAR commented May 20, 2025

Inside AioPikaBroker class, I had to implement the following logic:

class AioPikaBroker(AsyncBroker):
    ...
    async def declare_queues(
        self,
        channel: AbstractChannel,
    ) -> AbstractQueue:
        await channel.declare_queue(
            self._dead_letter_queue_name,
            **self._declare_queues_kwargs,
        )
        args: dict[str, Any] = {
            "x-dead-letter-exchange": "",
            "x-dead-letter-routing-key": self._dead_letter_queue_name,
            "x-expires": int(timedelta(weeks=2).total_seconds()) * 1000,
        }
    ...

I initially tried to supply "x-expires" like this:

AioPikaBroker(declare_queues_kwargs={"arguments": {"x-expires": 1000}})

But this wouldn't work, as there would be 2 kwargs

Proposition:

Merge args with declare_queues_kwargs["arguments"] if these additional arguments exist. I'm going to submit a related PR soon

@WiZeYAR WiZeYAR linked a pull request May 20, 2025 that will close this issue
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant