test retrieving messages in batches