Stop 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
(self)
| 70 | self.connection.ioloop.call_later(5, self._connection.ioloop.stop) |
| 71 | |
| 72 | def stop(self): |
| 73 | """Stop by closing the channel and connection. We |
| 74 | set a flag here so that we stop scheduling new messages to be |
| 75 | published. The IOLoop is started because this method is |
| 76 | invoked by the Try/Catch below when KeyboardInterrupt is caught. |
| 77 | Starting the IOLoop again will allow the publisher to cleanly |
| 78 | disconnect from RabbitMQ. |
| 79 | """ |
| 80 | logger.info('Stopping') |
| 81 | self.stopping = True |
| 82 | self.close_channel() |
| 83 | self.close_connection() |
| 84 | |
| 85 | def close_channel(self): |
| 86 | """Invoke this command to close the channel with RabbitMQ by sending |
no test coverage detected