Method for getting messages in a thread