2017-05-24 23 views
0

Ich arbeite eine Anwendung, wo ich E-Mails asynchron mit Sellerie und RabbitMQ senden muss. Wie kann ich überprüfen, ob der Mitarbeiter E-Mails gesendet hat oder fehlgeschlagen ist?Django mit Sellerie und RabbitMQ

+0

ja es ist möglich – e4c5

Antwort

0

This SO explains what you are looking for.

Grundsätzlich unten ist das, was Sie tun müssen.

task_id = uuid() 
result = sendemail.apply_async((), task_id=task_id) 
Now you know exactly what the task_id is and can now use it to get the AsyncResult: 

# grab the AsyncResult 
result = celery.result.AsyncResult(task_id) 

# print the task id 
print result.task_id 
09dad9cf-c9fa-4aee-933f-ff54dae39bdf 

# print the AsyncResult's status 
print result.status 
SUCCESS 

# print the result returned 
print result.result 
'Email sent successfully' 
+0

Danke wird es ausprobieren – AR7

Verwandte Themen