mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-02 23:39:34 +00:00
Add Kafka Stream's leaveGroupOnClose property
This commit makes it possible to set the option to leave the group on close at configuration/deployment time using configuration. See gh-50432 Signed-off-by: Trygve Aasjord <taasjord@users.noreply.github.com>
This commit is contained in:
committed by
Stéphane Nicoll
parent
42e725db10
commit
becdfefbed
+13
@@ -812,6 +812,11 @@ public class KafkaProperties {
|
||||
*/
|
||||
private @Nullable String stateDir;
|
||||
|
||||
/**
|
||||
* Whether the consumer should leave the group when stopping Kafka Streams.
|
||||
*/
|
||||
private boolean leaveGroupOnClose;
|
||||
|
||||
/**
|
||||
* Additional Kafka properties used to configure the streams.
|
||||
*/
|
||||
@@ -885,6 +890,14 @@ public class KafkaProperties {
|
||||
this.stateDir = stateDir;
|
||||
}
|
||||
|
||||
public boolean isLeaveGroupOnClose() {
|
||||
return this.leaveGroupOnClose;
|
||||
}
|
||||
|
||||
public void setLeaveGroupOnClose(boolean leaveGroupOnClose) {
|
||||
this.leaveGroupOnClose = leaveGroupOnClose;
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
return this.properties;
|
||||
}
|
||||
|
||||
+1
@@ -101,6 +101,7 @@ class KafkaStreamsAnnotationDrivenConfiguration {
|
||||
KafkaProperties.Cleanup cleanup = this.properties.getStreams().getCleanup();
|
||||
CleanupConfig cleanupConfig = new CleanupConfig(cleanup.isOnStartup(), cleanup.isOnShutdown());
|
||||
factoryBean.setCleanupConfig(cleanupConfig);
|
||||
factoryBean.setLeaveGroupOnClose(this.properties.getStreams().isLeaveGroupOnClose());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user