public void appendEndTxnMarker(long timestamp, EndTransactionMarker marker) {
        if (producerId == RecordBatch.NO_PRODUCER_ID)
            throw new IllegalArgumentException("End transaction marker requires a valid producerId");
        if (!isTransactional)
            throw new IllegalArgumentException("End transaction marker depends on batch transactional flag being enabled");
        ByteBuffer value = marker.serializeValue();
        appendControlRecord(timestamp, marker.controlType(), value);
    }
Append a control record at the next sequential offset.

@param timestamp The record timestamp
@param type The control record type (cannot be UNKNOWN)
@param value The control record value
clients/src/main/java/org/apache/kafka/common/record/MemoryRecordsBuilder.java