-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Consider 2 brokers
broker1 = AioPikaBroker(app_config.broker.url, queue_name="taskiq1")
broker2 = AioPikaBroker(app_config.broker.url, queue_name="taskiq2")
and some tasks
@broker1.task
async def task1():...
@broker2.task
async def task2():...
What I am trying to achieve is to run task1 on one worker and task2 on another,
let say task1 is heavy and I have dedicated worker for heavy tasks.
worker1: taskiq worker ...:broker1
worker2: taskiq worker ...:broker2
In this config both workers starts to receive tasks, hopefully tasks are registered
only with single broker so only one broker is running task, another one complains "task not found".
Obviously this is because default exchange for AioPikaBroker is ExchangeType.TOPIC, routing key is #
and bind key is task name, so all tasks are forwarded to all bound queues.
This behaviour is quite contra-intuitive and leads to unexpected side effect.
Also could you please recommend the way to achieve expected behaviour - just route different type of tasks for different workers?