You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/reference/asciidoc/streams.adoc
+14-10
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,13 @@ This is an `AbstractFactoryBean` implementation to expose a `StreamsBuilder` sin
46
46
[source, java]
47
47
----
48
48
@Bean
49
-
public FactoryBean<StreamsBuilderFactoryBean> myKStreamBuilder(StreamsConfig streamsConfig) {
49
+
public FactoryBean<StreamsBuilderFactoryBean> myKStreamBuilder(Properties streamsConfig) {
50
50
return new StreamsBuilderFactoryBean(streamsConfig);
51
51
}
52
52
----
53
53
54
+
IMPORTANT: Starting with version 2.2, the stream configuration is now provided as a simple `Properties` object, rather than a `StreamsConfig`.
55
+
54
56
The `StreamsBuilderFactoryBean` also implements `SmartLifecycle` to manage lifecycle of an internal `KafkaStreams` instance.
55
57
Similar to the Kafka Streams API, the `KStream` instances must be defined before starting the `KafkaStreams`, and that also applies for the Spring API for Kafka Streams.
56
58
Therefore we have to declare `KStream` s on the `StreamsBuilder` before the application context is refreshed, when we use default `autoStartup = true` on the `StreamsBuilderFactoryBean`.
@@ -79,7 +81,7 @@ You can autowire `StreamsBuilderFactoryBean` bean by type, but you should be sur
79
81
[source,java]
80
82
----
81
83
@Bean
82
-
public StreamsBuilderFactoryBean myKStreamBuilder(StreamsConfig streamsConfig) {
84
+
public StreamsBuilderFactoryBean myKStreamBuilder(Properties streamsConfig) {
83
85
return new StreamsBuilderFactoryBean(streamsConfig);
84
86
}
85
87
...
@@ -91,7 +93,7 @@ Or add `@Qualifier` for injection by name if you use interface bean definition:
91
93
[source,java]
92
94
----
93
95
@Bean
94
-
public FactoryBean<StreamsBuilder> myKStreamBuilder(StreamsConfig streamsConfig) {
96
+
public FactoryBean<StreamsBuilder> myKStreamBuilder(Properties streamsConfig) {
95
97
return new StreamsBuilderFactoryBean(streamsConfig);
96
98
}
97
99
...
@@ -115,12 +117,14 @@ IMPORTANT: Since Kafka Streams do not support headers, the `addTypeInfo` propert
115
117
116
118
==== Configuration
117
119
118
-
To configure the Kafka Streams environment, the `StreamsBuilderFactoryBean` requires a `Map` of particular properties or a `StreamsConfig` instance.
120
+
To configure the Kafka Streams environment, the `StreamsBuilderFactoryBean` requires a `Properties` instance.
119
121
See Apache Kafka https://kafka.apache.org/0102/documentation/#streamsconfigs[documentation] for all possible options.
120
122
121
-
To avoid boilerplate code for most cases, especially when you develop micro services, Spring for Apache Kafka provides the `@EnableKafkaStreams` annotation, which should be placed alongside with `@Configuration`.
122
-
Only you need is to declare `StreamsConfig` bean with the `defaultKafkaStreamsConfig` name.
123
-
A `StreamsBuilder` bean with the `defaultKafkaStreamsBuilder` name will be declare in the application context automatically.
123
+
IMPORTANT: Starting with version 2.2, the stream configuration is now provided as a simple `Properties` object, rather than a `StreamsConfig`.
124
+
125
+
To avoid boilerplate code for most cases, especially when you develop micro services, Spring for Apache Kafka provides the `@EnableKafkaStreams` annotation, which should be placed on a `@Configuration` class.
126
+
All you need is to declare a `Properties` bean with the name `defaultKafkaStreamsConfig`.
127
+
A `StreamsBuilder` bean, with the name `defaultKafkaStreamsBuilder`, will be declared in the application context automatically.
124
128
Any additional `StreamsBuilderFactoryBean` beans can be declared and used as well.
125
129
126
130
By default, when the factory bean is stopped, the `KafkaStreams.cleanUp()` method is called.
0 commit comments