mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Align Kafka's missingTopicsFatal default value
See gh-20917
This commit is contained in:
parent
856543c1c2
commit
a12eace2a8
@ -53,6 +53,7 @@ import org.springframework.util.unit.DataSize;
|
||||
* @author Stephane Nicoll
|
||||
* @author Artem Bilan
|
||||
* @author Nakul Mishra
|
||||
* @author Dhiren Mathur
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@ConfigurationProperties(prefix = "spring.kafka")
|
||||
@ -876,7 +877,7 @@ public class KafkaProperties {
|
||||
* Whether the container should fail to start if at least one of the configured
|
||||
* topics are not present on the broker.
|
||||
*/
|
||||
private boolean missingTopicsFatal = true;
|
||||
private boolean missingTopicsFatal = false;
|
||||
|
||||
public Type getType() {
|
||||
return this.type;
|
||||
|
@ -86,6 +86,7 @@ import static org.mockito.Mockito.verify;
|
||||
* @author Stephane Nicoll
|
||||
* @author Eddú Meléndez
|
||||
* @author Nakul Mishra
|
||||
* @author Dhiren Mathur
|
||||
*/
|
||||
class KafkaAutoConfigurationTests {
|
||||
|
||||
@ -364,7 +365,7 @@ class KafkaAutoConfigurationTests {
|
||||
"spring.kafka.listener.no-poll-threshold=2.5", "spring.kafka.listener.type=batch",
|
||||
"spring.kafka.listener.idle-event-interval=1s", "spring.kafka.listener.monitor-interval=45",
|
||||
"spring.kafka.listener.log-container-config=true",
|
||||
"spring.kafka.listener.missing-topics-fatal=false", "spring.kafka.jaas.enabled=true",
|
||||
"spring.kafka.listener.missing-topics-fatal=true", "spring.kafka.jaas.enabled=true",
|
||||
"spring.kafka.producer.transaction-id-prefix=foo", "spring.kafka.jaas.login-module=foo",
|
||||
"spring.kafka.jaas.control-flag=REQUISITE", "spring.kafka.jaas.options.useKeyTab=true")
|
||||
.run((context) -> {
|
||||
@ -389,7 +390,7 @@ class KafkaAutoConfigurationTests {
|
||||
assertThat(containerProperties.getIdleEventInterval()).isEqualTo(1000L);
|
||||
assertThat(containerProperties.getMonitorInterval()).isEqualTo(45);
|
||||
assertThat(containerProperties.isLogContainerConfig()).isTrue();
|
||||
assertThat(containerProperties.isMissingTopicsFatal()).isFalse();
|
||||
assertThat(containerProperties.isMissingTopicsFatal()).isTrue();
|
||||
assertThat(ReflectionTestUtils.getField(kafkaListenerContainerFactory, "concurrency")).isEqualTo(3);
|
||||
assertThat(kafkaListenerContainerFactory.isBatchListener()).isTrue();
|
||||
assertThat(context.getBeansOfType(KafkaJaasLoginModuleInitializer.class)).hasSize(1);
|
||||
@ -580,6 +581,17 @@ class KafkaAutoConfigurationTests {
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void testConcurrentKafkaListenerContainerFactoryMatchesDefaults() {
|
||||
Listener listenerProperties = new KafkaProperties().getListener();
|
||||
this.contextRunner.withUserConfiguration(ConsumerFactoryConfiguration.class).run((context) -> {
|
||||
ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory = context
|
||||
.getBean(ConcurrentKafkaListenerContainerFactory.class);
|
||||
assertThat(kafkaListenerContainerFactory.getContainerProperties().isMissingTopicsFatal())
|
||||
.isEqualTo(listenerProperties.isMissingTopicsFatal());
|
||||
});
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
static class MessageConverterConfiguration {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user