@@ -66,9 +66,9 @@ You can also configure the non-blocking retry support by creating `RetryTopicCon
66
66
----
67
67
@Bean
68
68
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, Object> template) {
69
- return RetryTopicConfiguration
70
- .builder ()
71
- .create(template);
69
+ return RetryTopicConfigurationBuilder
70
+ .newInstance ()
71
+ .create(template);
72
72
}
73
73
----
74
74
====
@@ -82,8 +82,8 @@ To achieve more fine-grained control over how to handle non-blocking retrials fo
82
82
----
83
83
@Bean
84
84
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> template) {
85
- return RetryTopicConfiguration
86
- .builder ()
85
+ return RetryTopicConfigurationBuilder
86
+ .newInstance ()
87
87
.fixedBackoff(3000)
88
88
.maxAttempts(5)
89
89
.includeTopics("my-topic", "my-other-topic")
@@ -92,13 +92,13 @@ return RetryTopicConfiguration
92
92
93
93
@Bean
94
94
public RetryTopicConfiguration myOtherRetryTopic(KafkaTemplate<String, MyOtherPojo> template) {
95
- return RetryTopicConfiguration
96
- .builder ()
97
- .exponentialBackoff(1000, 2, 5000)
98
- .maxAttempts(4)
99
- .excludeTopics("my-topic", "my-other-topic")
100
- .retryOn(MyException.class)
101
- .create(template);
95
+ return RetryTopicConfigurationBuilder
96
+ .newInstance ()
97
+ .exponentialBackoff(1000, 2, 5000)
98
+ .maxAttempts(4)
99
+ .excludeTopics("my-topic", "my-other-topic")
100
+ .retryOn(MyException.class)
101
+ .create(template);
102
102
}
103
103
----
104
104
====
@@ -137,11 +137,12 @@ public void processMessage(MyPojo message) {
137
137
----
138
138
@Bean
139
139
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> template) {
140
- return RetryTopicConfiguration
141
- .builder()
142
- .fixedBackoff(3000)
143
- .maxAttempts(4)
144
- .build
140
+ return RetryTopicConfigurationBuilder
141
+ .newInstance()
142
+ .fixedBackoff(3000)
143
+ .maxAttempts(4)
144
+ .build();
145
+ }
145
146
----
146
147
====
147
148
@@ -152,11 +153,12 @@ You can also provide a custom implementation of Spring Retry's `SleepingBackOffP
152
153
----
153
154
@Bean
154
155
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> template) {
155
- return RetryTopicConfiguration
156
- .builder()
157
- .customBackOff(new MyCustomBackOffPolicy())
158
- .maxAttempts(5)
159
- .build
156
+ return RetryTopicConfigurationBuilder
157
+ .newInstance()
158
+ .customBackOff(new MyCustomBackOffPolicy())
159
+ .maxAttempts(5)
160
+ .build();
161
+ }
160
162
----
161
163
====
162
164
@@ -185,12 +187,13 @@ public void processMessage(MyPojo message) {
185
187
----
186
188
@Bean
187
189
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> template) {
188
- return RetryTopicConfiguration
189
- .builder()
190
- .fixedBackoff(3000)
191
- .maxAttempts(5)
192
- .useSingleTopicForFixedDelays()
193
- .build
190
+ return RetryTopicConfigurationBuilder
191
+ .newInstance()
192
+ .fixedBackoff(3000)
193
+ .maxAttempts(5)
194
+ .useSingleTopicForFixedDelays()
195
+ .build();
196
+ }
194
197
----
195
198
====
196
199
@@ -217,11 +220,12 @@ public void processMessage(MyPojo message) {
217
220
----
218
221
@Bean
219
222
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> template) {
220
- return RetryTopicConfiguration
221
- .builder()
222
- .fixedBackoff(2000)
223
- .timeoutAfter(5000)
224
- .build
223
+ return RetryTopicConfigurationBuilder
224
+ .newInstance()
225
+ .fixedBackoff(2000)
226
+ .timeoutAfter(5000)
227
+ .build();
228
+ }
225
229
----
226
230
====
227
231
@@ -249,11 +253,11 @@ public void processMessage(MyPojo message) {
249
253
----
250
254
@Bean
251
255
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyOtherPojo> template) {
252
- return RetryTopicConfiguration
253
- .builder ()
254
- .notRetryOn(MyDontRetryException.class)
255
- .create(template);
256
- }
256
+ return RetryTopicConfigurationBuilder
257
+ .newInstance ()
258
+ .notRetryOn(MyDontRetryException.class)
259
+ .create(template);
260
+ }
257
261
----
258
262
====
259
263
@@ -267,21 +271,20 @@ You can decide which topics will and will not be handled by a `RetryTopicConfigu
267
271
[source, java]
268
272
----
269
273
@Bean
270
- public RetryTopicConfigurer myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
271
- return RetryTopicConfigurer
272
- .builder ()
273
- .includeTopics(List.of("my-included-topic", "my-other-included-topic"))
274
- .create(template);
274
+ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
275
+ return RetryTopicConfigurationBuilder
276
+ .newInstance ()
277
+ .includeTopics(List.of("my-included-topic", "my-other-included-topic"))
278
+ .create(template);
275
279
}
276
280
277
281
@Bean
278
- public RetryTopicConfigurer myOtherRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
279
- return RetryTopicConfigurer
280
- .builder ()
281
- .excludeTopic("my-excluded-topic")
282
- .create(template);
282
+ public RetryTopicConfiguration myOtherRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
283
+ return RetryTopicConfigurationBuilder
284
+ .newInstance ()
285
+ .excludeTopic("my-excluded-topic")
286
+ .create(template);
283
287
}
284
-
285
288
----
286
289
====
287
290
@@ -313,19 +316,19 @@ public void processMessage(MyPojo message) {
313
316
[source, java]
314
317
----
315
318
@Bean
316
- public RetryTopicConfigurer myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
317
- return RetryTopicConfigurer
318
- .builder ()
319
- .autoCreateTopicsWith(2, 3)
320
- .create(template);
319
+ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
320
+ return RetryTopicConfigurationBuilder
321
+ .newInstance ()
322
+ .autoCreateTopicsWith(2, 3)
323
+ .create(template);
321
324
}
322
325
323
326
@Bean
324
- public RetryTopicConfigurer myOtherRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
325
- return RetryTopicConfigurer
326
- .builder ()
327
- .doNotAutoCreateRetryTopics()
328
- .create(template);
327
+ public RetryTopicConfiguration myOtherRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
328
+ return RetryTopicConfigurationBuilder
329
+ .newInstance ()
330
+ .doNotAutoCreateRetryTopics()
331
+ .create(template);
329
332
}
330
333
----
331
334
====
@@ -363,12 +366,12 @@ public void processMessage(MyPojo message) {
363
366
----
364
367
@Bean
365
368
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyOtherPojo> template) {
366
- return RetryTopicConfiguration
367
- .builder ()
368
- .retryTopicSuffix("-my-retry-suffix")
369
- .dltTopicSuffix("-my-dlt-suffix")
370
- .create(template);
371
- }
369
+ return RetryTopicConfigurationBuilder
370
+ .newInstance ()
371
+ .retryTopicSuffix("-my-retry-suffix")
372
+ .dltTopicSuffix("-my-dlt-suffix")
373
+ .create(template);
374
+ }
372
375
----
373
376
====
374
377
@@ -394,11 +397,11 @@ public void processMessage(MyPojo message) {
394
397
----
395
398
@Bean
396
399
public RetryTopicConfiguration myRetryTopic(KafkaTemplate<String, MyPojo> template) {
397
- return RetryTopicConfiguration
398
- .builder ()
399
- .suffixTopicsWithIndexValues()
400
- .create(template);
401
- }
400
+ return RetryTopicConfigurationBuilder
401
+ .newInstance ()
402
+ .suffixTopicsWithIndexValues()
403
+ .create(template);
404
+ }
402
405
----
403
406
====
404
407
@@ -438,11 +441,11 @@ If a bean instance of the provided class is found in the application context tha
438
441
[source, java]
439
442
----
440
443
@Bean
441
- public RetryTopicConfigurer myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
442
- return RetryTopicConfigurer
443
- .builder ()
444
- .dltProcessor(MyCustomDltProcessor.class, "processDltMessage")
445
- .create(template);
444
+ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
445
+ return RetryTopicConfigurationBuilder
446
+ .newInstance ()
447
+ .dltProcessor(MyCustomDltProcessor.class, "processDltMessage")
448
+ .create(template);
446
449
}
447
450
448
451
@Component
@@ -485,12 +488,12 @@ public void processMessage(MyPojo message) {
485
488
[source, java]
486
489
----
487
490
@Bean
488
- public RetryTopicConfigurer myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
489
- return RetryTopicConfigurer
490
- .builder ()
491
- .dltProcessor(MyCustomDltProcessor.class, "processDltMessage")
492
- .doNotRetryOnDltFailure()
493
- .create(template);
491
+ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
492
+ return RetryTopicConfigurationBuilder
493
+ .newInstance ()
494
+ .dltProcessor(MyCustomDltProcessor.class, "processDltMessage")
495
+ .doNotRetryOnDltFailure()
496
+ .create(template);
494
497
}
495
498
----
496
499
====
@@ -517,11 +520,11 @@ public void processMessage(MyPojo message) {
517
520
[source, java]
518
521
----
519
522
@Bean
520
- public RetryTopicConfigurer myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
521
- return RetryTopicConfigurer
522
- .builder ()
523
- .doNotConfigureDlt()
524
- .create(template);
523
+ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
524
+ return RetryTopicConfigurationBuilder
525
+ .newInstance ()
526
+ .doNotConfigureDlt()
527
+ .create(template);
525
528
}
526
529
----
527
530
====
@@ -547,19 +550,21 @@ public void processMessage(MyPojo message) {
547
550
[source, java]
548
551
----
549
552
@Bean
550
- public RetryTopicConfigurer myRetryTopic(KafkaTemplate<Integer, MyPojo> template, ConcurrentKafkaListenerContainerFactory<Integer, MyPojo> factory) {
551
- return RetryTopicConfigurer
552
- .builder()
553
- .listenerFactory(factory)
554
- .create(template);
553
+ public RetryTopicConfiguration myRetryTopic(KafkaTemplate<Integer, MyPojo> template,
554
+ ConcurrentKafkaListenerContainerFactory<Integer, MyPojo> factory) {
555
+
556
+ return RetryTopicConfigurationBuilder
557
+ .newInstance()
558
+ .listenerFactory(factory)
559
+ .create(template);
555
560
}
556
561
557
562
@Bean
558
- public RetryTopicConfigurer myOtherRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
559
- return RetryTopicConfigurer
560
- .builder ()
561
- .listenerFactory("my-retry-topic-factory")
562
- .create(template);
563
+ public RetryTopicConfiguration myOtherRetryTopic(KafkaTemplate<Integer, MyPojo> template) {
564
+ return RetryTopicConfigurationBuilder
565
+ .newInstance ()
566
+ .listenerFactory("my-retry-topic-factory")
567
+ .create(template);
563
568
}
564
569
----
565
570
====
0 commit comments