implement getNumOfPendingMessages