'Stop the example by closing the channel and connection. We
set a flag here so that we stop scheduling new messages to be
published. The IOLoop is started because this method is
invoked by the Try/Catch below when KeyboardInterrupt is caught.
Starting the IOLoop again will allow the publisher to cleanly
disconnect from RabbitMQ.'

def stop(self):

    LOGGER.info('Stopping')
    self._stopping = True
    self.close_channel()
    self.close_connection()
