erenavsarogullari commented on a change in pull request #4539: [Pulsar-Client]
Add Producer Builder API Numeric Properties Validations
URL: https://github.com/apache/pulsar/pull/4539#discussion_r298813018
##########
File path:
pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerBuilderImpl.java
##########
@@ -213,18 +214,21 @@ private ProducerBuilderImpl(PulsarClientImpl client,
ProducerConfigurationData c
@Override
public ProducerBuilder<T> batchingMaxPublishDelay(long batchDelay,
@NonNull TimeUnit timeUnit) {
+ checkArgument(batchDelay >= 0, "batchDelay needs to be >= 0");
conf.setBatchingMaxPublishDelayMicros(timeUnit.toMicros(batchDelay));
return this;
}
@Override
public ProducerBuilder<T> batchingMaxMessages(int
batchMessagesMaxMessagesPerBatch) {
+ checkArgument(batchMessagesMaxMessagesPerBatch >= 0,
"batchMessagesMaxMessagesPerBatch needs to be >= 0");
Review comment:
Same comment as above.
Also, there is following mismatch on **legacy C++ and Java Client APIs**.
Alignment can also be useful here if makes sense.
`
ProducerConfiguration.cc ## setBatchingMaxMessages => "batchingMaxMessages
needs to be greater than 1"
`
`
ProducerConfiguration.setBatchingMaxMessages =>
checkArgument(batchMessagesMaxMessagesPerBatch > 0);
`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services