Code added to retrieve all messages from queue