I've written a python class RuoteAMQP::Participant

http://meego.gitorious.org/meego-infrastructure-tools/boss/trees/master/integration/RuoteAMQP

It is part of the r-a demo in that project.

I've also put the code in http://github.com/lbt/ruote-amqp-pyclient

------------------

#!/usr/bin/python
import sys
import os
import random

# Just until Ruote-AMQP is in a proper place
sys.path.append(os.path.dirname(__file__)+"/../../integration")

from  RuoteAMQP.workitem import Workitem
from  RuoteAMQP.participant import Participant

import simplejson as json

class MyPart(Participant):
    def consume(self):
        wi = self.workitem
        print "Got a workitem:"
        print json.dumps(wi.to_h(), indent=4)
        size=random.randint(500,1000)
        print "\nSize is %s" % size
        wi.set_field("image.size", size)
        wi.set_result(True)

print "Started a python participant"
p = MyPart(ruote_queue="sizer", amqp_host="amqpvm", amqp_vhost="ruote-test")
p.run()


--
"Don't worry, you'll be fine; I saw it work in a cartoon once..."

--
you received this message because you are subscribed to the "ruote users" group.
to post : send email to [email protected]
to unsubscribe : send email to [email protected]
more options : http://groups.google.com/group/openwferu-users?hl=en

Reply via email to