CORE-4854: Moved the message handling into a separate thread.