public void verifyMessageSize ( int maxMessageSize ) { Iterator < MessageAndOffset > shallowIter = internalIterator ( true ) ; while ( shallowIter . hasNext ( ) ) { MessageAndOffset messageAndOffset = shallowIter . next ( ) ; int payloadSize = messageAndOffset . message . payloadSize ( ) ; if ( payloadSize > maxMessageSize ) { throw new MessageSizeTooLargeException ( "payload size of " + payloadSize + " larger than " + maxMessageSize ) ; } } }
check max size of each message