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
"kafka.interceptorClasses={cfg.interceptorClass}"// cfg.interceptorClass is exposed by Stove
52
114
```
53
115
54
116
!!! Important
55
-
`kafka.` prefix is an assumption that you can change it with your own prefix.
56
117
57
-
Make sure that `StoveKafkaBridge` is in your classpath.
118
+
`kafka.` prefix or `interceptorClasses` are assumptions that you can change it with your own prefix or configuration.
58
119
59
-
## Usage
120
+
## Spring Kafka
60
121
61
-
When you want to use Kafka with Application Aware testing it provides more assertion capabilities. It is recommended way of working.
62
-
Stove-Kafka does that with intercepting the messages.
122
+
When you want to use Kafka with Application Aware testing it provides more assertion capabilities. It is recommended way
123
+
of working. Stove-Kafka does that with intercepting the messages.
63
124
64
-
## How to get?
125
+
###How to get?
65
126
66
127
=== "Gradle"
67
128
@@ -81,11 +142,12 @@ Stove-Kafka does that with intercepting the messages.
81
142
</dependency>
82
143
```
83
144
84
-
## Configure
145
+
###Configure
85
146
86
-
### Configuration Values
147
+
####Configuration Values
87
148
88
-
Kafka works with some settings as default, your application might have these values as not configurable, to make the application testable we need to tweak a little bit.
149
+
Kafka works with some settings as default, your application might have these values as not configurable, to make the
150
+
application testable we need to tweak a little bit.
89
151
90
152
If you have the following configurations:
91
153
@@ -99,70 +161,76 @@ As an example:
99
161
100
162
```kotlin
101
163
TestSystem()
102
-
.with{
103
-
httpClient()
104
-
kafka()
105
-
springBoot(
106
-
runner = { parameters ->
107
-
com.trendyol.exampleapp.run(parameters)
108
-
},
109
-
withParameters =listOf(
110
-
"logging.level.root=error",
111
-
"logging.level.org.springframework.web=error",
112
-
"spring.profiles.active=default",
113
-
"server.http2.enabled=false",
114
-
"kafka.heartbeatInSeconds=2",
115
-
"kafka.autoCreateTopics=true",
116
-
"kafka.offset=earliest"
117
-
)
118
-
)
119
-
}.run()
164
+
.with{
165
+
httpClient()
166
+
kafka()
167
+
springBoot(
168
+
runner = { parameters ->
169
+
com.trendyol.exampleapp.run(parameters)
170
+
},
171
+
withParameters =listOf(
172
+
"logging.level.root=error",
173
+
"logging.level.org.springframework.web=error",
174
+
"spring.profiles.active=default",
175
+
"server.http2.enabled=false",
176
+
"kafka.heartbeatInSeconds=2",
177
+
"kafka.autoCreateTopics=true",
178
+
"kafka.offset=earliest"
179
+
)
180
+
)
181
+
}.run()
120
182
```
121
183
122
-
As you can see, we pass these configuration values as parameters. Since they are configurable, the application considers these values instead of application-default values.
184
+
As you can see, we pass these configuration values as parameters. Since they are configurable, the application considers
185
+
these values instead of application-default values.
123
186
124
187
### Consumer Settings
125
188
126
-
Second thing we need to do is tweak your consumer configuration. For that we will provide Stove-Kafka interceptor to your Kafka configuration.
189
+
Second thing we need to do is tweak your consumer configuration. For that we will provide Stove-Kafka interceptor to
190
+
your Kafka configuration.
127
191
128
-
Locate to the point where you define your `ConcurrentKafkaListenerContainerFactory` or where you can set the interceptor. Interceptor needs to implement `ConsumerAwareRecordInterceptor<String, String>` since
192
+
Locate to the point where you define your `ConcurrentKafkaListenerContainerFactory` or where you can set the
193
+
interceptor. Interceptor needs to implement `ConsumerAwareRecordInterceptor<String, String>` since
129
194
Stove-Kafka [relies on that](https://github.com/Trendyol/stove/blob/main/starters/spring/stove-spring-testing-e2e-kafka/src/main/kotlin/com/trendyol/stove/testing/e2e/kafka/TestSystemInterceptor.kt).
0 commit comments