Created
April 5, 2012 14:41
-
-
Save nloadholtes/2311553 to your computer and use it in GitHub Desktop.
Gearman 2.x worker example
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 characters
# | |
# worker.py | |
# | |
# Based on code from http://www.darkcoding.net/software/choosing-a-message-queue-for-python-on-ubuntu-on-a-vps/ | |
# | |
import time | |
from gearman import GearmanWorker | |
def speakTask(gearman_worker, job): | |
r = 'Hello %s' % job.data | |
print(r) | |
return r | |
worker = GearmanWorker("[127.0.0.1]") | |
worker.register_task('speak', speakTask) | |
worker.work() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment