public class KafkaMessageProducer<K,V> extends java.lang.Object implements MessageProducer<K,V>
Constructor and Description |
---|
KafkaMessageProducer(java.lang.String topic,
org.apache.kafka.clients.producer.KafkaProducer<K,V> producer,
ProducerTopicMessageCounter msgCounter,
java.lang.String producerName) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush()
This method is a blank default implementation in order to avoid it being a breaking change.
|
java.util.concurrent.Future<org.apache.kafka.clients.producer.RecordMetadata> |
send(K key,
V value)
Asynchronously send a record to a specific topic
|
java.util.concurrent.Future<org.apache.kafka.clients.producer.RecordMetadata> |
send(K key,
V value,
org.apache.kafka.common.header.Headers headers) |
public KafkaMessageProducer(java.lang.String topic, org.apache.kafka.clients.producer.KafkaProducer<K,V> producer, ProducerTopicMessageCounter msgCounter, java.lang.String producerName)
public java.util.concurrent.Future<org.apache.kafka.clients.producer.RecordMetadata> send(K key, V value)
MessageProducer
send
in interface MessageProducer<K,V>
key
- key to sendvalue
- value to sendRecordMetadata
specifying the partition the record
was sent to, the offset it was assigned and the timestamp of the record.public java.util.concurrent.Future<org.apache.kafka.clients.producer.RecordMetadata> send(K key, V value, org.apache.kafka.common.header.Headers headers)
send
in interface MessageProducer<K,V>
public void close()
public void flush()
MessageProducer
flush
in interface MessageProducer<K,V>