K
- Outgoing record key typeV
- Outgoing record value typeT
- Correlation metadata typepublic class SenderRecord<K,V,T>
extends org.apache.kafka.clients.producer.ProducerRecord<K,V>
SenderResult
to its corresponding record.Modifier and Type | Method and Description |
---|---|
T |
correlationMetadata()
Returns the correlation metadata associated with this instance which is not sent to Kafka,
but can be used to correlate response to outbound request.
|
static <K,V,T> SenderRecord<K,V,T> |
create(org.apache.kafka.clients.producer.ProducerRecord<K,V> record,
T correlationMetadata)
Converts a
ProducerRecord a SenderRecord to send to Kafka. |
static <K,V,T> SenderRecord<K,V,T> |
create(String topic,
Integer partition,
Long timestamp,
K key,
V value,
T correlationMetadata)
Creates a
SenderRecord to send to Kafka. |
public static <K,V,T> SenderRecord<K,V,T> create(org.apache.kafka.clients.producer.ProducerRecord<K,V> record, T correlationMetadata)
ProducerRecord
a SenderRecord
to send to Kafka.record
- the producer record to send to KafkacorrelationMetadata
- Additional correlation metadata that is not sent to Kafka, but is
included in the response to match SenderResult
to this record.KafkaSender.send(org.reactivestreams.Publisher)
public static <K,V,T> SenderRecord<K,V,T> create(String topic, Integer partition, Long timestamp, K key, V value, T correlationMetadata)
SenderRecord
to send to Kafka.topic
- Topic to which record is sentpartition
- The partition to which the record is sent. If null, the partitioner configured
for the KafkaSender
will be used to choose the partition.timestamp
- The timestamp of the record. If null, the current timestamp will be assigned by the producer.
The timestamp will be overwritten by the broker if the topic is configured with
TimestampType.LOG_APPEND_TIME
. The actual timestamp
used will be returned in SenderResult.recordMetadata()
key
- The key to be included in the record. May be null.value
- The contents to be included in the record.correlationMetadata
- Additional correlation metadata that is not sent to Kafka, but is
included in the response to match SenderResult
to this record.KafkaSender.send(org.reactivestreams.Publisher)
public T correlationMetadata()