|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.kafka.clients.consumer.ConsumerRecord
public final class ConsumerRecord
A key/value pair to be received from Kafka. This consists of a topic name and a partition number, from which the record is being received and an offset that points to the record in a Kafka partition.
Constructor Summary | |
---|---|
ConsumerRecord(java.lang.String topic,
int partitionId,
byte[] key,
byte[] value,
long offset)
Creates a record to be received from a specified topic and partition |
|
ConsumerRecord(java.lang.String topic,
int partitionId,
byte[] value,
long offset)
Create a record with no key |
|
ConsumerRecord(java.lang.String topic,
int partitionId,
java.lang.Exception error)
Creates a record with an error code |
Method Summary | |
---|---|
java.lang.Exception |
error()
|
byte[] |
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 |
java.lang.String |
topic()
The topic this record is received from |
TopicPartition |
topicAndPartition()
The TopicPartition object containing the topic and partition |
byte[] |
value()
The value |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConsumerRecord(java.lang.String topic, int partitionId, byte[] key, byte[] value, long offset)
topic
- The topic this record is received frompartitionId
- The partition of the topic this record is received fromkey
- The key of the record, if one existsvalue
- The record contentsoffset
- The offset of this record in the corresponding Kafka partitionpublic ConsumerRecord(java.lang.String topic, int partitionId, byte[] value, long offset)
topic
- The topic this record is received frompartitionId
- The partition of the topic this record is received fromvalue
- The record contentsoffset
- The offset of this record in the corresponding Kafka partitionpublic ConsumerRecord(java.lang.String topic, int partitionId, java.lang.Exception error)
topic
- The topic this record is received frompartitionId
- The partition of the topic this record is received fromerror
- The exception corresponding to the error code returned by the server for this topic partitionMethod Detail |
---|
public java.lang.String topic()
public int partition()
public TopicPartition topicAndPartition()
public byte[] key() throws java.lang.Exception
java.lang.Exception
- The exception thrown while fetching this record.public byte[] value() throws java.lang.Exception
java.lang.Exception
- The exception thrown while fetching this record.public long offset() throws java.lang.Exception
java.lang.Exception
- The exception thrown while fetching this record.public java.lang.Exception error()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |