K - the key type.V - the value type.public class LoggingProducerListener<K,V> extends java.lang.Object implements ProducerListener<K,V>
ProducerListener that logs exceptions thrown when sending messages.| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_CONTENT_LOGGED
Default max content logged.
|
| 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisInterestedInSuccess, onError, onSuccess, onSuccesspublic static final int DEFAULT_MAX_CONTENT_LOGGED
public 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>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