90
90
* @author Elliot Kennedy
91
91
* @author Nakul Mishra
92
92
* @author Pawel Lozinski
93
+ * @author Adrian Chlebosz
93
94
*
94
95
* @since 2.2
95
96
*/
@@ -113,7 +114,7 @@ public class EmbeddedKafkaBroker implements InitializingBean, DisposableBean {
113
114
*/
114
115
public static final String BROKER_LIST_PROPERTY = "spring.embedded.kafka.brokers.property" ;
115
116
116
- private static final Duration DEFAULT_ADMIN_TIMEOUT = Duration . ofSeconds ( 10 ) ;
117
+ public static final int DEFAULT_ADMIN_TIMEOUT = 10 ;
117
118
118
119
public static final int DEFAULT_ZK_SESSION_TIMEOUT = 18000 ;
119
120
@@ -157,7 +158,7 @@ public class EmbeddedKafkaBroker implements InitializingBean, DisposableBean {
157
158
158
159
private int [] kafkaPorts ;
159
160
160
- private Duration adminTimeout = DEFAULT_ADMIN_TIMEOUT ;
161
+ private Duration adminTimeout = Duration . ofSeconds ( DEFAULT_ADMIN_TIMEOUT ) ;
161
162
162
163
private int zkConnectionTimeout = DEFAULT_ZK_CONNECTION_TIMEOUT ;
163
164
@@ -238,33 +239,24 @@ public EmbeddedKafkaBroker kafkaPorts(int... ports) {
238
239
}
239
240
240
241
/**
241
- * Set an explicit port for the embedded Zookeeper .
242
- * @param port the port.
243
- * @return the {@link EmbeddedKafkaBroker} .
242
+ * Set the system property with this name to the list of broker addresses .
243
+ * @param brokerListProperty the brokerListProperty to set
244
+ * @return this broker .
244
245
* @since 2.3
245
246
*/
246
- public EmbeddedKafkaBroker zkPort ( int port ) {
247
- this .zkPort = port ;
247
+ public EmbeddedKafkaBroker brokerListProperty ( String brokerListProperty ) {
248
+ this .brokerListProperty = brokerListProperty ;
248
249
return this ;
249
250
}
250
- /**
251
- * Set the timeout in seconds for admin operations (e.g. topic creation, close).
252
- * Default 30 seconds.
253
- * @param adminTimeout the timeout.
254
- * @since 2.2
255
- */
256
- public void setAdminTimeout (int adminTimeout ) {
257
- this .adminTimeout = Duration .ofSeconds (adminTimeout );
258
- }
259
251
260
252
/**
261
- * Set the system property with this name to the list of broker addresses .
262
- * @param brokerListProperty the brokerListProperty to set
263
- * @return this broker .
253
+ * Set an explicit port for the embedded Zookeeper .
254
+ * @param port the port.
255
+ * @return the {@link EmbeddedKafkaBroker} .
264
256
* @since 2.3
265
257
*/
266
- public EmbeddedKafkaBroker brokerListProperty ( String brokerListProperty ) {
267
- this .brokerListProperty = brokerListProperty ;
258
+ public EmbeddedKafkaBroker zkPort ( int port ) {
259
+ this .zkPort = port ;
268
260
return this ;
269
261
}
270
262
@@ -286,6 +278,27 @@ public void setZkPort(int zkPort) {
286
278
this .zkPort = zkPort ;
287
279
}
288
280
281
+ /**
282
+ * Set the timeout in seconds for admin operations (e.g. topic creation, close).
283
+ * @param adminTimeout the timeout.
284
+ * @return the {@link EmbeddedKafkaBroker}
285
+ * @since 2.8.5
286
+ */
287
+ public EmbeddedKafkaBroker adminTimeout (int adminTimeout ) {
288
+ this .adminTimeout = Duration .ofSeconds (adminTimeout );
289
+ return this ;
290
+ }
291
+
292
+ /**
293
+ * Set the timeout in seconds for admin operations (e.g. topic creation, close).
294
+ * Default 10 seconds.
295
+ * @param adminTimeout the timeout.
296
+ * @since 2.2
297
+ */
298
+ public void setAdminTimeout (int adminTimeout ) {
299
+ this .adminTimeout = Duration .ofSeconds (adminTimeout );
300
+ }
301
+
289
302
/**
290
303
* Set connection timeout for the client to the embedded Zookeeper.
291
304
* @param zkConnectionTimeout the connection timeout,
0 commit comments