discover
discover

Reputation: 559

Send celery task message to rabbitmq

I usually use celery with Django and run shared tasks in Django.

But for specific case, I want to add task queue to rabbitmq manually without running Django or celerybeat.

Is there any simple python script or shell cmd to do that?

Upvotes: 4

Views: 4956

Answers (1)

2ps
2ps

Reputation: 15956

You can use the send_task method to queue a task to an arbitrary celery broker. But, you do have to know the app name and broker url so that you can send the task to the right place.


from celery import Celery

app = Celery('app_name', broker='pyamqp://guest@localhost//')
app.send_task('namespace.my_task', kwargs={
    'arg1': 'value1',
    'arg2': 'value2',
})

Upvotes: 7

Related Questions