91
91
* @author Elliot Kennedy
92
92
* @author Nakul Mishra
93
93
* @author Pawel Lozinski
94
+ * @author Adrian Chlebosz
94
95
*
95
96
* @since 2.2
96
97
*/
@@ -114,7 +115,7 @@ public class EmbeddedKafkaBroker implements InitializingBean, DisposableBean {
114
115
*/
115
116
public static final String BROKER_LIST_PROPERTY = "spring.embedded.kafka.brokers.property" ;
116
117
117
- private static final Duration DEFAULT_ADMIN_TIMEOUT = Duration . ofSeconds ( 10 ) ;
118
+ public static final int DEFAULT_ADMIN_TIMEOUT = 10 ;
118
119
119
120
public static final int DEFAULT_ZK_SESSION_TIMEOUT = 18000 ;
120
121
@@ -176,7 +177,7 @@ public class EmbeddedKafkaBroker implements InitializingBean, DisposableBean {
176
177
177
178
private int [] kafkaPorts ;
178
179
179
- private Duration adminTimeout = DEFAULT_ADMIN_TIMEOUT ;
180
+ private Duration adminTimeout = Duration . ofSeconds ( DEFAULT_ADMIN_TIMEOUT ) ;
180
181
181
182
private int zkConnectionTimeout = DEFAULT_ZK_CONNECTION_TIMEOUT ;
182
183
@@ -257,33 +258,24 @@ public EmbeddedKafkaBroker kafkaPorts(int... ports) {
257
258
}
258
259
259
260
/**
260
- * Set an explicit port for the embedded Zookeeper .
261
- * @param port the port.
262
- * @return the {@link EmbeddedKafkaBroker} .
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 .
263
264
* @since 2.3
264
265
*/
265
- public EmbeddedKafkaBroker zkPort ( int port ) {
266
- this .zkPort = port ;
266
+ public EmbeddedKafkaBroker brokerListProperty ( String brokerListProperty ) {
267
+ this .brokerListProperty = brokerListProperty ;
267
268
return this ;
268
269
}
269
- /**
270
- * Set the timeout in seconds for admin operations (e.g. topic creation, close).
271
- * Default 30 seconds.
272
- * @param adminTimeout the timeout.
273
- * @since 2.2
274
- */
275
- public void setAdminTimeout (int adminTimeout ) {
276
- this .adminTimeout = Duration .ofSeconds (adminTimeout );
277
- }
278
270
279
271
/**
280
- * Set the system property with this name to the list of broker addresses .
281
- * @param brokerListProperty the brokerListProperty to set
282
- * @return this broker .
272
+ * Set an explicit port for the embedded Zookeeper .
273
+ * @param port the port.
274
+ * @return the {@link EmbeddedKafkaBroker} .
283
275
* @since 2.3
284
276
*/
285
- public EmbeddedKafkaBroker brokerListProperty ( String brokerListProperty ) {
286
- this .brokerListProperty = brokerListProperty ;
277
+ public EmbeddedKafkaBroker zkPort ( int port ) {
278
+ this .zkPort = port ;
287
279
return this ;
288
280
}
289
281
@@ -305,6 +297,27 @@ public void setZkPort(int zkPort) {
305
297
this .zkPort = zkPort ;
306
298
}
307
299
300
+ /**
301
+ * Set the timeout in seconds for admin operations (e.g. topic creation, close).
302
+ * @param adminTimeout the timeout.
303
+ * @return the {@link EmbeddedKafkaBroker}
304
+ * @since 2.8.5
305
+ */
306
+ public EmbeddedKafkaBroker adminTimeout (int adminTimeout ) {
307
+ this .adminTimeout = Duration .ofSeconds (adminTimeout );
308
+ return this ;
309
+ }
310
+
311
+ /**
312
+ * Set the timeout in seconds for admin operations (e.g. topic creation, close).
313
+ * Default 10 seconds.
314
+ * @param adminTimeout the timeout.
315
+ * @since 2.2
316
+ */
317
+ public void setAdminTimeout (int adminTimeout ) {
318
+ this .adminTimeout = Duration .ofSeconds (adminTimeout );
319
+ }
320
+
308
321
/**
309
322
* Set connection timeout for the client to the embedded Zookeeper.
310
323
* @param zkConnectionTimeout the connection timeout,
0 commit comments