// If message has partition key, need to construct it with Key for checkSum to match
Message messageWithKey = new Message(bytes,keyBytes);
Message messageWithoutKey = new Message(bytes);
long checksum = key.getChecksum();
if (checksum != messageWithKey.checksum() && checksum != messageWithoutKey.checksum()) {
throw new ChecksumException("Invalid message checksum : MessageWithKey : "
+ messageWithKey.checksum() + " MessageWithoutKey checksum : "
+ messageWithoutKey.checksum()
+ ". Expected " + key.getChecksum(),
key.getOffset());
}