Skip to content

Add configuration option to configure Kafka Listener's onlyLogRecordMetadata #24582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ 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::getOnlyLogRecordMetadata).to(container::setOnlyLogRecordMetadata);
map.from(properties::isMissingTopicsFatal).to(container::setMissingTopicsFatal);
map.from(this.transactionManager).to(container::setTransactionManager);
map.from(this.rebalanceListener).to(container::setConsumerRebalanceListener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,12 @@ 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;

/**
* 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 @@ -1015,6 +1021,14 @@ public void setLogContainerConfig(Boolean logContainerConfig) {
this.logContainerConfig = logContainerConfig;
}

public Boolean getOnlyLogRecordMetadata() {
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 @@ -392,6 +392,7 @@ void listenerProperties() {
"spring.kafka.listener.no-poll-threshold=2.5", "spring.kafka.listener.type=batch",
"spring.kafka.listener.idle-between-polls=1s", "spring.kafka.listener.idle-event-interval=1s",
"spring.kafka.listener.monitor-interval=45", "spring.kafka.listener.log-container-config=true",
"spring.kafka.listener.only-log-record-metadata=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")
Expand All @@ -418,6 +419,7 @@ void listenerProperties() {
assertThat(containerProperties.getIdleEventInterval()).isEqualTo(1000L);
assertThat(containerProperties.getMonitorInterval()).isEqualTo(45);
assertThat(containerProperties.isLogContainerConfig()).isTrue();
assertThat(containerProperties.isOnlyLogRecordMetadata()).isTrue();
assertThat(containerProperties.isMissingTopicsFatal()).isTrue();
assertThat(kafkaListenerContainerFactory).extracting("concurrency").isEqualTo(3);
assertThat(kafkaListenerContainerFactory.isBatchListener()).isTrue();
Expand Down