code: def publish(self, message, exchange=None):
          
          exchange = exchange or config.conf["publish_exchange"]
          while True:
              client = yield self.whenConnected()
              try:
                  yield client.publish(message, exchange)
                  break
              except ConnectionException:
                  continue
docs: Publish a :class:`fedora_messaging.message.Message` to an `exchange`_
          on the message broker. This call will survive connection failures and try
          until it succeeds or is canceled.
  
          Args:
              message (message.Message): The message to publish.
              exchange (str): The name of the AMQP exchange to publish to; defaults
                  to :ref:`conf-publish-exchange`
  
          returns:
              defer.Deferred: A deferred that fires when the message is published.
  
          Raises:
              PublishReturned: If the published message is rejected by the broker.
              ConnectionException: If a connection error occurs while publishing. Calling
                  this method again will wait for the next connection and publish when it
                  is available.
  
          .. _exchange: https://www.rabbitmq.com/tutorials/amqp-concepts.html#exchanges