Ejemplo n.º 1
0
 def sendMessage(self, exchangeName, message, routingKey=None):
     self._connect()
     chan = self.conn.channel()
     bound_exchange = Exchange(exchangeName)
     routingKey = routingKey if routingKey else exchangeName
     try:
         bound_exchange = bound_exchange(chan)
         message = bound_exchange.Message(message)
         bound_exchange.publish(message, routingKey)
     finally:
         chan.close()
         self._release()