Interface ProducerListener<K,V>
-
- Type Parameters:
K- the key type.V- the value type.
- All Known Implementing Classes:
CompositeProducerListener,LoggingProducerListener
public interface ProducerListener<K,V>Listener for handling outbound Kafka messages. Exactly one of its methods will be invoked, depending on whether the write has been acknowledged or not. Its main goal is to provide a stateless singleton delegate forCallbacks, which, in all but the most trivial cases, requires creating a separate instance per message.- See Also:
Callback
-
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default voidonError(org.apache.kafka.clients.producer.ProducerRecord<K,V> producerRecord, java.lang.Exception exception)Invoked after an attempt to send a message has failed.default voidonSuccess(org.apache.kafka.clients.producer.ProducerRecord<K,V> producerRecord, 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).
-
-
-
Method Detail
-
onSuccess
default void onSuccess(org.apache.kafka.clients.producer.ProducerRecord<K,V> producerRecord, 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).- Parameters:
producerRecord- the actual sent recordrecordMetadata- the result of the successful send operation
-
-