public class LoggingProducerListener extends DefaultProducerListener
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,
java.lang.Object key,
java.lang.Object payload,
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.
|
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,
java.lang.Object key,
java.lang.Object payload,
java.lang.Exception exception)
ProducerListeneronError in interface ProducerListeneronError in class DefaultProducerListenertopic - the destination topicpartition - the destination partition (could be null)key - the key of the outbound messagepayload - the payload of the outbound messageexception - the exception thrown