Created
June 24, 2010 07:23
-
-
Save hamsolodev/451109 to your computer and use it in GitHub Desktop.
Revisions
-
markhellewell renamed this gist
Jun 24, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
markhellewell revised this gist
Jun 24, 2010 . 1 changed file with 22 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ from carrot.connection import DjangoBrokerConnection from carrot.messaging import Publisher, Consumer connection = DjangoBrokerConnection() publisher = Publisher(connection=connection, exchange="sendemail", routing_key="sendemail_emails") publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.send({'email': '[email protected]'}) publisher.close() connection.close() -
markhellewell revised this gist
Jun 24, 2010 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -16,9 +16,9 @@ then in my Celery Task: try: connection = DjangoBrokerConnection() consumer = Consumer(connection=connection, queue="sendemail", exchange="sendemail", routing_key="sendemail_emails") logger.info("sending emails...") for message in consumer.iterqueue(): -
markhellewell created this gist
Jun 24, 2010 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,26 @@ if request.method == "POST": email_form = SendAnEmail(request.POST, prefix='emailform') if email_form.is_valid(): connection = DjangoBrokerConnection() publisher = Publisher(connection=connection, exchange="sendemail", routing_key="sendemail_emails") publisher.send(email_form.cleaned_data.get('email_address')) publisher.close() connection.close() then in my Celery Task: try: connection = DjangoBrokerConnection() consumer = Consumer(connection=connection, queue="senddrop", exchange="senddrop", routing_key="senddrop_emails") logger.info("sending emails...") for message in consumer.iterqueue(): logger.info("boo") logger.info(message.payload.get('email'))