Esempio n. 1
0
 def receive_tasks(self, queue_name):
     s = Stomper()
     s.connect(host=self.host, port=self.port, user=self.user, 
               password=self.password, timeout=self.timeout)
     s.subscribe("/queue/%s" % queue_name)
     while True:
         f, json_obj = s.receive_as_json()
         if not f:
             break
         yield json_obj
     s.disconnect()
Esempio n. 2
0
 def send_task(self, task, queue_name):
     s = Stomper()
     s.connect(host=self.host, port=self.port, user=self.user, 
               password=self.password, timeout=self.timeout)
     s.send_as_json("/queue/%s" % queue_name, task.get_task_info(), True)
     s.disconnect()