Skip to content

Instantly share code, notes, and snippets.

@nloadholtes
Created April 5, 2012 14:42
Show Gist options
  • Save nloadholtes/2311561 to your computer and use it in GitHub Desktop.
Save nloadholtes/2311561 to your computer and use it in GitHub Desktop.
Gearman 2.x client example
#
# client.py
#
# Based on code from http://www.darkcoding.net/software/choosing-a-message-queue-for-python-on-ubuntu-on-a-vps/
#
import sys
import time
from gearman import GearmanClient
client = GearmanClient(["127.0.0.1"])
i = 0
while 1:
result = client.submit_job('speak', str(i))
print 'Dispatched %d' % i
print 'Result is: %s' % str(result.result)
i += 1
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment