[Bug] Java Pulsar Producer - ProducerBuilder loadConf() throws RuntimeException when loading "maxPendingMessages" property from config map.
See original GitHub issueSearch before asking
- I searched in the issues and found nothing similar.
Version
Pulsar version: 2.10.1
Minimal reproduce step
Add maxPendingMessages
parameter into the config map and load the config.
HashMap<String, Object> pulsarProducerProperties = new HashMap<String, Object>();
pulsarProducerProperties.put("topicName", "my-topic");
pulsarProducerProperties.put("producerName", "my-producer");
pulsarProducerProperties.put("maxPendingMessages", 2000);
pulsarProducer = pulsarClient.newProducer()
.loadConf(pulsarProducerProperties)
.create();
What did you expect to see?
This seems to be a regression because this seems to be working in Pulsar 2.9.2 .
What did you see instead?
A runtime exception is thrown by loadConf()
method
Exception: java.lang.RuntimeException: Failed to load config into existing configuration data
If the maxPendingMessages
config is removed from the map , the Producer is created but the masPendingMessages
value is 0
instead of the default value of1000
as documented.
10:50:06.730 [pulsar-client-io-1-1] INFO org.apache.pulsar.client.impl.ProducerStatsRecorderImpl - Starting Pulsar producer perf with config: {"topicName":"my-topic","producerName":"my-producer","sendTimeoutMs":30000,"blockIfQueueFull":false,"maxPendingMessages":0,"maxPendingMessagesAcrossPartitions":0,"messageRoutingMode":"RoundRobinPartition","hashingScheme":"JavaStringHash","cryptoFailureAction":"FAIL","batchingMaxPublishDelayMicros":1000,"batchingPartitionSwitchFrequencyByPublishDelay":10,"batchingMaxMessages":1000,"batchingMaxBytes":131072,"batchingEnabled":true,"chunkingEnabled":false,"compressionType":"NONE","initialSequenceId":null,"autoUpdatePartitions":true,"autoUpdatePartitionsIntervalSeconds":60,"multiSchema":true,"accessMode":"Shared","lazyStartPartitionedProducers":false,"properties":{},"initialSubscriptionName":null}
Anything else?
Tried to use the PulsarBuilder API to set the maxPendingMessages and leave some other configuration in the config map (still using loadConfig()
) hit the same exception. Code snippet as below (omitted the other producer config set in the config of type HashMap<String,Object>
.
pulsarProducer = pulsarClient.newProducer()
.topic(topicName)
.producerName(producerName)
.maxPendingMessages(2000)
.loadConf(pulsarProducerProperties)
.create();
I looked through the codes and couldn’t find exactly what is the root cause of this error. Appreciate any pointers from the community.
Are you willing to submit a PR?
- I’m willing to submit a PR!
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
We should use memoryLimit instead: https://github.com/apache/pulsar/issues/13306
Closed as answered.