Move MessageBroker connection out of loop