Implemented auto retry for writing messages
Further testing