Skip to content

Commit

Permalink
Remove deprecated Spring Kafka's only-log-record-metadata property
Browse files Browse the repository at this point in the history
  • Loading branch information
snicoll committed Mar 15, 2022
1 parent 9bf77b1 commit 0e07eb2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ private void configureContainer(ContainerProperties container) {
map.from(properties::getMonitorInterval).as(Duration::getSeconds).as(Number::intValue)
.to(container::setMonitorInterval);
map.from(properties::getLogContainerConfig).to(container::setLogContainerConfig);
map.from(properties::isOnlyLogRecordMetadata).to(container::setOnlyLogRecordMetadata);
map.from(properties::isMissingTopicsFatal).to(container::setMissingTopicsFatal);
map.from(properties::isImmediateStop).to(container::setStopImmediate);
map.from(this.transactionManager).to(container::setTransactionManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,6 @@ public enum Type {
*/
private Boolean logContainerConfig;

/**
* Whether to suppress the entire record from being written to the log when
* retries are being attempted.
*/
private boolean onlyLogRecordMetadata = true;

/**
* Whether the container should fail to start if at least one of the configured
* topics are not present on the broker.
Expand Down Expand Up @@ -1056,14 +1050,6 @@ public void setLogContainerConfig(Boolean logContainerConfig) {
this.logContainerConfig = logContainerConfig;
}

public boolean isOnlyLogRecordMetadata() {
return this.onlyLogRecordMetadata;
}

public void setOnlyLogRecordMetadata(boolean onlyLogRecordMetadata) {
this.onlyLogRecordMetadata = onlyLogRecordMetadata;
}

public boolean isMissingTopicsFatal() {
return this.missingTopicsFatal;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1503,6 +1503,16 @@
"name": "spring.kafka.jaas.control-flag",
"defaultValue": "required"
},
{
"name": "spring.kafka.listener.only-log-record-metadata",
"type": "java.lang.Boolean",
"defaultValue": true,
"description": "Whether to suppress the entire record from being written to the log when retries are being attempted.",
"deprecation": {
"reason": "Use KafkaUtils#setConsumerRecordFormatter instead.",
"level": "error"
}
},
{
"name": "spring.kafka.listener.type",
"defaultValue": "single"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,17 +432,6 @@ void listenerProperties() {
});
}

@Test
@Deprecated
void logOnlyRecordMetadataProperty() {
this.contextRunner.withPropertyValues("spring.kafka.listener.only-log-record-metadata=true").run((context) -> {
AbstractKafkaListenerContainerFactory<?, ?, ?> kafkaListenerContainerFactory = (AbstractKafkaListenerContainerFactory<?, ?, ?>) context
.getBean(KafkaListenerContainerFactory.class);
ContainerProperties containerProperties = kafkaListenerContainerFactory.getContainerProperties();
assertThat(containerProperties.isOnlyLogRecordMetadata()).isTrue();
});
}

@Test
void testKafkaTemplateRecordMessageConverters() {
this.contextRunner.withUserConfiguration(MessageConverterConfiguration.class)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2012-2021 the original author or authors.
* Copyright 2012-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -55,7 +55,6 @@ void isolationLevelEnumConsistentWithKafkaVersion() {
void listenerDefaultValuesAreConsistent() {
ContainerProperties container = new ContainerProperties("test");
Listener listenerProperties = new KafkaProperties().getListener();
assertThat(listenerProperties.isOnlyLogRecordMetadata()).isEqualTo(container.isOnlyLogRecordMetadata());
assertThat(listenerProperties.isMissingTopicsFatal()).isEqualTo(container.isMissingTopicsFatal());
}

Expand Down

0 comments on commit 0e07eb2

Please sign in to comment.