K - the key type.V - the value type.public class LoggingProducerListener<K,V> extends ProducerListenerAdapter<K,V>
ProducerListener that logs exceptions thrown when sending messages.| Constructor and Description |
|---|
LoggingProducerListener() |
| Modifier and Type | Method and Description |
|---|---|
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 |
setIncludeContents(boolean includeContents)
Whether the log message should include the contents (key and payload).
|
void |
setMaxContentLogged(int maxContentLogged)
The maximum amount of data to be logged for either key or password.
|
isInterestedInSuccess, onSuccesspublic void setIncludeContents(boolean includeContents)
includeContents - true if the contents of the message should be loggedpublic void setMaxContentLogged(int maxContentLogged)
maxContentLogged - the maximum amount of data being logged.public void onError(java.lang.String topic,
java.lang.Integer partition,
K key,
V value,
java.lang.Exception exception)
ProducerListeneronError in interface ProducerListener<K,V>onError in class ProducerListenerAdapter<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 thrown