Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
f4799c74
Commit
f4799c74
authored
Oct 12, 2020
by
Adrien Bennadji
Committed by
Stephane Nicoll
Oct 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add configuration options for Kafka Stream's CleanupConfig
See gh-23636
parent
a5b27789
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
KafkaProperties.java
...ngframework/boot/autoconfigure/kafka/KafkaProperties.java
+40
-0
KafkaStreamsAnnotationDrivenConfiguration.java
...gure/kafka/KafkaStreamsAnnotationDrivenConfiguration.java
+5
-0
No files found.
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java
View file @
f4799c74
...
...
@@ -37,6 +37,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import
org.springframework.boot.context.properties.PropertyMapper
;
import
org.springframework.boot.convert.DurationUnit
;
import
org.springframework.core.io.Resource
;
import
org.springframework.kafka.core.CleanupConfig
;
import
org.springframework.kafka.listener.ContainerProperties.AckMode
;
import
org.springframework.kafka.security.jaas.KafkaJaasLoginModuleInitializer
;
import
org.springframework.util.CollectionUtils
;
...
...
@@ -722,6 +723,11 @@ public class KafkaProperties {
*/
private
String
stateDir
;
/**
* Cleanup configuration for the state stores.
*/
private
Cleanup
cleanup
;
/**
* Additional Kafka properties used to configure the streams.
*/
...
...
@@ -791,6 +797,14 @@ public class KafkaProperties {
this
.
stateDir
=
stateDir
;
}
public
Cleanup
getCleanup
()
{
return
cleanup
;
}
public
void
setCleanup
(
Cleanup
cleanup
)
{
this
.
cleanup
=
cleanup
;
}
public
Map
<
String
,
String
>
getProperties
()
{
return
this
.
properties
;
}
...
...
@@ -1259,6 +1273,32 @@ public class KafkaProperties {
}
public
static
class
Cleanup
{
/**
* Cleanup the application's state on start.
*/
private
boolean
onStart
=
false
;
/**
* Cleanup the application's state on stop.
*/
private
boolean
onStop
=
true
;
public
CleanupConfig
buildCleanupConfig
()
{
return
new
CleanupConfig
(
this
.
onStart
,
this
.
onStop
);
}
public
boolean
isOnStart
()
{
return
onStart
;
}
public
boolean
isOnStop
()
{
return
onStop
;
}
}
@SuppressWarnings
(
"serial"
)
private
static
class
Properties
extends
HashMap
<
String
,
Object
>
{
...
...
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaStreamsAnnotationDrivenConfiguration.java
View file @
f4799c74
...
...
@@ -91,6 +91,11 @@ class KafkaStreamsAnnotationDrivenConfiguration {
@Override
public
void
afterPropertiesSet
()
{
this
.
factoryBean
.
setAutoStartup
(
this
.
properties
.
getStreams
().
isAutoStartup
());
KafkaProperties
.
Cleanup
cleanup
=
this
.
properties
.
getStreams
().
getCleanup
();
if
(
cleanup
!=
null
)
{
this
.
factoryBean
.
setCleanupConfig
(
cleanup
.
buildCleanupConfig
());
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment