Added option to automatically reconnection/retry during publish.