Kicking tasks from a task in another broker. #80
-
Quick question, we are using aio_pika brokers with several tasks each. Sometimes we have a requirement where one task kicks off another task in another broker. Because of this the startup method of the other brokers is never executed (due to it being in the main code). So we receive the obvious error "ValueError: Please run startup before kicking." What would be the recommended approach here? |
Beta Was this translation helpful? Give feedback.
Answered by
s3rius
Mar 28, 2023
Replies: 1 comment 2 replies
-
I guess, you can add startup of another broker in your primary one. Like this: from taskiq import InMemoryBroker, TaskiqEvents, TaskiqState
broker1 = InMemoryBroker()
broker2 = InMemoryBroker()
@broker1.on_event(TaskiqEvents.WORKER_STARTUP)
async def run_another_broker(_: TaskiqState):
await broker2.startup() Replace inmemory brokers with your own. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
lembregtse
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I guess, you can add startup of another broker in your primary one.
Like this:
Replace inmemory brokers with your own.