K
- the key type.V
- the value type.public interface ProducerListener<K,V>
Callback
s,
which, in all but the most trivial cases, requires creating a separate instance per message.Callback
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).
|
void onSuccess(java.lang.String topic, java.lang.Integer partition, K key, V value, org.apache.kafka.clients.producer.RecordMetadata recordMetadata)
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 operationvoid onError(java.lang.String topic, java.lang.Integer partition, K key, V value, java.lang.Exception exception)
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 thrownboolean isInterestedInSuccess()