public class ConsumerRecord<K,V>
extends java.lang.Object
Modifier and Type | Field | Description |
---|---|---|
static long |
NO_TIMESTAMP |
|
static int |
NULL_CHECKSUM |
|
static int |
NULL_SIZE |
Constructor | Description |
---|---|
ConsumerRecord(java.lang.String topic,
int partition,
long offset,
long timestamp,
org.apache.kafka.common.record.TimestampType timestampType,
long checksum,
int serializedKeySize,
int serializedValueSize,
K key,
V value) |
Creates a record to be received from a specified topic and partition (provided for
compatibility with Kafka 0.10 before the message format supported headers).
|
ConsumerRecord(java.lang.String topic,
int partition,
long offset,
long timestamp,
org.apache.kafka.common.record.TimestampType timestampType,
java.lang.Long checksum,
int serializedKeySize,
int serializedValueSize,
K key,
V value,
Headers headers) |
Creates a record to be received from a specified topic and partition
|
ConsumerRecord(java.lang.String topic,
int partition,
long offset,
K key,
V value) |
Creates a record to be received from a specified topic and partition (provided for
compatibility with Kafka 0.9 before the message format supported timestamps and before
serialized metadata were exposed).
|
Modifier and Type | Method | Description |
---|---|---|
long |
checksum() |
Deprecated.
As of Kafka 0.11.0. Because of the potential for message format conversion on the broker, the
checksum returned by the broker may not match what was computed by the producer.
It is therefore unsafe to depend on this checksum for end-to-end delivery guarantees. Additionally,
message format v2 does not include a record-level checksum (for performance, the record checksum
was replaced with a batch checksum). To maintain compatibility, a partial checksum computed from
the record timestamp, serialized key size, and serialized value size is returned instead, but
this should not be depended on for end-to-end reliability.
|
Headers |
headers() |
The headers
|
K |
key() |
The key (or null if no key is specified)
|
long |
offset() |
The position of this record in the corresponding Kafka partition.
|
int |
partition() |
The partition from which this record is received
|
int |
serializedKeySize() |
The size of the serialized, uncompressed key in bytes.
|
int |
serializedValueSize() |
The size of the serialized, uncompressed value in bytes.
|
long |
timestamp() |
The timestamp of this record
|
org.apache.kafka.common.record.TimestampType |
timestampType() |
The timestamp type of this record
|
java.lang.String |
topic() |
The topic this record is received from
|
java.lang.String |
toString() |
|
V |
value() |
The value
|
public static final long NO_TIMESTAMP
public static final int NULL_SIZE
public static final int NULL_CHECKSUM
public ConsumerRecord(java.lang.String topic, int partition, long offset, K key, V value)
topic
- The topic this record is received frompartition
- The partition of the topic this record is received fromoffset
- The offset of this record in the corresponding Kafka partitionkey
- The key of the record, if one exists (null is allowed)value
- The record contentspublic ConsumerRecord(java.lang.String topic, int partition, long offset, long timestamp, org.apache.kafka.common.record.TimestampType timestampType, long checksum, int serializedKeySize, int serializedValueSize, K key, V value)
topic
- The topic this record is received frompartition
- The partition of the topic this record is received fromoffset
- The offset of this record in the corresponding Kafka partitiontimestamp
- The timestamp of the record.timestampType
- The timestamp typechecksum
- The checksum (CRC32) of the full recordserializedKeySize
- The length of the serialized keyserializedValueSize
- The length of the serialized valuekey
- The key of the record, if one exists (null is allowed)value
- The record contentspublic ConsumerRecord(java.lang.String topic, int partition, long offset, long timestamp, org.apache.kafka.common.record.TimestampType timestampType, java.lang.Long checksum, int serializedKeySize, int serializedValueSize, K key, V value, Headers headers)
topic
- The topic this record is received frompartition
- The partition of the topic this record is received fromoffset
- The offset of this record in the corresponding Kafka partitiontimestamp
- The timestamp of the record.timestampType
- The timestamp typechecksum
- The checksum (CRC32) of the full recordserializedKeySize
- The length of the serialized keyserializedValueSize
- The length of the serialized valuekey
- The key of the record, if one exists (null is allowed)value
- The record contentsheaders
- The headers of the record.public java.lang.String topic()
public int partition()
public Headers headers()
public K key()
public V value()
public long offset()
public long timestamp()
public org.apache.kafka.common.record.TimestampType timestampType()
@Deprecated public long checksum()
public int serializedKeySize()
public int serializedValueSize()
public java.lang.String toString()
toString
in class java.lang.Object