diff --git a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java index d4cd36a22e15f..9768fd7c74b0f 100644 --- a/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java +++ b/pulsar-client/src/main/java/org/apache/pulsar/client/impl/MessagesImpl.java @@ -22,11 +22,13 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import lombok.extern.slf4j.Slf4j; import net.jcip.annotations.NotThreadSafe; import org.apache.pulsar.client.api.Message; import org.apache.pulsar.client.api.Messages; @NotThreadSafe +@Slf4j public class MessagesImpl implements Messages { private final List> messageList; @@ -49,10 +51,14 @@ protected boolean canAdd(Message message) { return true; } if (maxNumberOfMessages > 0 && currentNumberOfMessages + 1 > maxNumberOfMessages) { + log.warn("can't add message to the container, has exceeded the maxNumberOfMessages : {} ", + maxNumberOfMessages); return false; } if (maxSizeOfMessages > 0 && currentSizeOfMessages + message.size() > maxSizeOfMessages) { + log.warn("can't add message to the container, has exceeded the maxSizeOfMessages : {} ", + maxSizeOfMessages); return false; }