org.apache.kafka.clients.producer.internals
Class RecordBatch
java.lang.Object
org.apache.kafka.clients.producer.internals.RecordBatch
public final class RecordBatch
- extends java.lang.Object
A batch of records that is or will be sent.
This class is not thread safe and external synchronization must be used when modifying it
Method Summary |
void |
done(long baseOffset,
java.lang.RuntimeException exception)
Complete the request |
java.lang.String |
toString()
|
FutureRecordMetadata |
tryAppend(byte[] key,
byte[] value,
Callback callback)
Append the record to the current record set and return the relative offset within that record set |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
recordCount
public int recordCount
maxRecordSize
public int maxRecordSize
attempts
public volatile int attempts
createdMs
public final long createdMs
drainedMs
public long drainedMs
lastAttemptMs
public long lastAttemptMs
records
public final MemoryRecords records
topicPartition
public final TopicPartition topicPartition
RecordBatch
public RecordBatch(TopicPartition tp,
MemoryRecords records,
long now)
tryAppend
public FutureRecordMetadata tryAppend(byte[] key,
byte[] value,
Callback callback)
- Append the record to the current record set and return the relative offset within that record set
- Returns:
- The RecordSend corresponding to this record or null if there isn't sufficient room.
done
public void done(long baseOffset,
java.lang.RuntimeException exception)
- Complete the request
- Parameters:
baseOffset
- The base offset of the messages assigned by the serverexception
- The exception that occurred (or null if the request was successful)
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object