Search code examples
apache-pulsarspring-pulsar

How to modify the producer cache properties for Spring Pulsar 0.2.0 producer?


Spring Pulsar 0.2.0

how to modify ProducerConfigProperties.cache parameter

i want to change cache properties through application.properties, such as:

spring.pulsar.producer.cache.expire-after-access=600s
spring.pulsar.producer.cache.maximum-size=1000
spring.pulsar.producer.cache.initial-capacity=5

but, ProducerConfigProperties dont have setCache method

Is there any other way to modify this parameter?


Solution

  • Setting the properties in the application.properties (or application.yml) will set the underlying cache values. Are you not seeing the values being set?

    The reason there is no "setCache" is because we use JavaBeans property bindings. There is no setCache() method but instead a getCache().setXyz(). However, if you are trying to set the fields on the ProducerConfigProperties object, it is probably already too late in the lifecycle. The recommended way to set these is via application.properties.