taskiq-aio-pika icon indicating copy to clipboard operation
taskiq-aio-pika copied to clipboard

multiple queues

Open vvanglro opened this issue 2 years ago • 7 comments

Like this, I just give a simple example, or there may be other more elegant ways to create multiple queues.

from taskiq_aio_pika import AioPikaBroker

broker = AioPikaBroker(queue_name="q1")
broker.add_queue(queue_name="q2")

# The first way to specify the queue name
@broker.task(queue="q1")
async def test() -> None:
    print("nothing")

@broker.task(queue="q2")
async def test2() -> None:
    print("nothing")    

# The second way to specify the queue name
@broker.task()
async def test3() -> None:
    print("nothing")

await test3.kicker().with_queue(queue="q1").kiq()

vvanglro avatar May 08 '23 01:05 vvanglro