make changes to be more fault tolerant: clean up connections, brokers, failed_messages