K - the key type.V - the value type.public abstract class ProducerListenerAdapter<K,V> extends java.lang.Object implements ProducerListener<K,V>
ProducerListener, to be used as base class for other implementations.| Constructor and Description |
|---|
ProducerListenerAdapter() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isInterestedInSuccess()
Return true if this listener is interested in success as well as failure.
|
void |
onError(java.lang.String topic,
java.lang.Integer partition,
K key,
V value,
java.lang.Exception exception)
Invoked after an attempt to send a message has failed.
|
void |
onSuccess(java.lang.String topic,
java.lang.Integer partition,
K key,
V value,
org.apache.kafka.clients.producer.RecordMetadata recordMetadata)
Invoked after the successful send of a message (that is, after it has been acknowledged by the broker).
|
public void onSuccess(java.lang.String topic,
java.lang.Integer partition,
K key,
V value,
org.apache.kafka.clients.producer.RecordMetadata recordMetadata)
ProducerListeneronSuccess in interface ProducerListener<K,V>topic - the destination topicpartition - the destination partition (could be null)key - the key of the outbound messagevalue - the payload of the outbound messagerecordMetadata - the result of the successful send operationpublic void onError(java.lang.String topic,
java.lang.Integer partition,
K key,
V value,
java.lang.Exception exception)
ProducerListeneronError in interface ProducerListener<K,V>topic - the destination topicpartition - the destination partition (could be null)key - the key of the outbound messagevalue - the payload of the outbound messageexception - the exception thrownpublic boolean isInterestedInSuccess()
ProducerListenerisInterestedInSuccess in interface ProducerListener<K,V>