def _publish_deferred_messages(self):
        """Called when pika is connected and has a channel open to publish
        any requests buffered.

        """
        global message_stack
        if not self._rabbitmq_is_closed and message_stack:
            LOGGER.info('Publishing %i deferred message(s)', len(message_stack))
            while message_stack:
                self._publish_message(*message_stack.pop())