How can a producer set up from a Kafka factory be disabled?
I started from this example from https://docs.spring.io/spring-kafka/reference/html/
I expected that adding a property like
props.put("autoStartup", "false");
would disable the message sending, but it does not seem to work. Running the application still sends messages.
There's no producer property like autoStartup
, so it doesn't mean disable the message sending
. For the producer configuration, you could see here.
In Spring Kafka, autoStartup
is used for Listener Container.
You could set this property by:
In @KafkaListener
@KafkaListener(id = "myContainer", topics = "myTopic", autoStartup = "false")
Or
**ListenerContainerFactory.setAutoStartup(Boolean autoStartup)