コード例 #1
0
 def send_message_wait(self, to, message, timeout=60):
     self.send_message(to, message)
     try:
         msg = self.incoming_queue.get(timeout=timeout)
         qpid_util.ack_message(self, message=msg)
         return msg.content.body
     except qpid.queue.Empty:
         raise QpidTransportException("Send to %s timed out after %d secs" % (to, timeout))
コード例 #2
0
 def _poll(self):
     while not self.is_stopped:
         if (self.connected):
             is_closed = self.channel(1).closed
             if (is_closed):
                 #print "reopening.."
                 try:
                     del self.channels[1]
                 except KeyError:
                     pass
                 self.connected = False
         if (not self.connected):
             try:
                 self.connect()
             except Exception, e:
                 #try to connect again next iteration
                 #print "trying again later ",e
                 pass
         try:
             msg = self.incoming_queue.get(timeout=15)
             qpid_util.ack_message(self, message=msg)                
             self.pending_calls.put(msg.content.body)
         except qpid.queue.Empty:
             pass