Skip to content

Commit 22737f5

Browse files
garyrussellartembilan
authored andcommitted
GH-2089: Add Deprecations for 3.0 Removal
In preparation for #2089 Missed deprecations.
1 parent 9300f7c commit 22737f5

File tree

7 files changed

+28
-7
lines changed

7 files changed

+28
-7
lines changed

spring-kafka-test/src/test/java/org/springframework/kafka/test/hamcrest/KafkaMatchersTests.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2020 the original author or authors.
2+
* Copyright 2017-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,10 @@
2323
import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasTimestamp;
2424
import static org.springframework.kafka.test.hamcrest.KafkaMatchers.hasValue;
2525

26+
import java.util.Optional;
27+
2628
import org.apache.kafka.clients.consumer.ConsumerRecord;
29+
import org.apache.kafka.common.header.internals.RecordHeaders;
2730
import org.apache.kafka.common.record.TimestampType;
2831
import org.junit.jupiter.api.Test;
2932

@@ -37,7 +40,8 @@ public class KafkaMatchersTests {
3740
@Test
3841
public void testKeyMatcher() {
3942
ConsumerRecord<String, String> record = new ConsumerRecord<>("topic", 0, 10,
40-
1487694048607L, TimestampType.CREATE_TIME, 123L, 2, 3, "key1", "value1");
43+
1487694048607L, TimestampType.CREATE_TIME, 2, 3, "key1", "value1", new RecordHeaders(),
44+
Optional.empty());
4145
assertThat(record, hasKey("key1"));
4246
assertThat(record, hasValue("value1"));
4347
assertThat(record, hasPartition(0));
@@ -48,7 +52,8 @@ public void testKeyMatcher() {
4852
@Test
4953
public void noMatchOnTimestamp() {
5054
ConsumerRecord<String, String> record = new ConsumerRecord<>("topic", 0, 10,
51-
1487694048607L, TimestampType.CREATE_TIME, 123L, 2, 3, "key1", "value1");
55+
1487694048607L, TimestampType.CREATE_TIME, 2, 3, "key1", "value1", new RecordHeaders(),
56+
Optional.empty());
5257

5358
assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> assertThat(record, hasTimestamp(123L)))
5459
.withMessageContaining(

spring-kafka/src/main/java/org/springframework/kafka/config/AbstractKafkaListenerContainerFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ public void setRetryTemplate(RetryTemplate retryTemplate) {
191191
* Set a callback to be used with the {@link #setRetryTemplate(RetryTemplate)
192192
* retryTemplate}.
193193
* @param recoveryCallback the callback.
194+
* @deprecated since 2.8 - use a suitably configured error handler instead.
194195
*/
196+
@Deprecated
195197
public void setRecoveryCallback(RecoveryCallback<? extends Object> recoveryCallback) {
196198
this.recoveryCallback = recoveryCallback;
197199
}

spring-kafka/src/main/java/org/springframework/kafka/config/AbstractKafkaListenerEndpoint.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2021 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -326,6 +326,7 @@ public void setAckDiscarded(boolean ackDiscarded) {
326326
this.ackDiscarded = ackDiscarded;
327327
}
328328

329+
@Deprecated
329330
@Nullable
330331
protected RetryTemplate getRetryTemplate() {
331332
return this.retryTemplate;
@@ -341,6 +342,7 @@ public void setRetryTemplate(RetryTemplate retryTemplate) {
341342
this.retryTemplate = retryTemplate;
342343
}
343344

345+
@Deprecated
344346
@Nullable
345347
protected RecoveryCallback<?> getRecoveryCallback() {
346348
return this.recoveryCallback;
@@ -349,7 +351,9 @@ protected RecoveryCallback<?> getRecoveryCallback() {
349351
/**
350352
* Set a callback to be used with the {@link #setRetryTemplate(RetryTemplate)}.
351353
* @param recoveryCallback the callback.
354+
* @deprecated since 2.8 - use a suitably configured error handler instead.
352355
*/
356+
@Deprecated
353357
public void setRecoveryCallback(RecoveryCallback<? extends Object> recoveryCallback) {
354358
this.recoveryCallback = recoveryCallback;
355359
}

spring-kafka/src/main/java/org/springframework/kafka/listener/ContainerProperties.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2021 the original author or authors.
2+
* Copyright 2016-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -148,7 +148,9 @@ public enum EOSMode {
148148

149149
/**
150150
* 'transactional.id' fencing (0.11 - 2.4 brokers).
151+
* @deprecated 3.0 and later will require 2.5+ brokers
151152
*/
153+
@Deprecated
152154
V1,
153155

154156
/**
@@ -188,7 +190,9 @@ public enum EOSMode {
188190
/**
189191
* Return the mode or the aliased mode.
190192
* @return the mode.
193+
* @deprecated aliases will be removed in 3.0
191194
*/
195+
@Deprecated
192196
public EOSMode getMode() {
193197
return this.mode;
194198
}

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ private void checkGroupInstance(Properties properties, ConsumerFactory<K, V> con
926926
}
927927
}
928928

929+
@SuppressWarnings("deprecation")
929930
private boolean setupSubBatchPerPartition() {
930931
Boolean subBatching = this.containerProperties.getSubBatchPerPartition();
931932
if (subBatching != null) {

spring-kafka/src/test/java/org/springframework/kafka/listener/SubBatchPerPartitionTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -133,6 +133,7 @@ void withFilter() throws Exception {
133133
this.registry.stop();
134134
}
135135

136+
@SuppressWarnings("deprecation")
136137
@Test
137138
void defaults() {
138139
Map<String, Object> props = KafkaTestUtils.consumerProps("sbpp", "false", this.broker);

spring-kafka/src/test/java/org/springframework/kafka/listener/TransactionalContainerTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2021 the original author or authors.
2+
* Copyright 2017-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -143,21 +143,25 @@ public static void setup() {
143143
embeddedKafka = EmbeddedKafkaCondition.getBroker();
144144
}
145145

146+
@SuppressWarnings("deprecation")
146147
@Test
147148
public void testConsumeAndProduceTransactionKTM() throws Exception {
148149
testConsumeAndProduceTransactionGuts(false, AckMode.RECORD, EOSMode.V1);
149150
}
150151

152+
@SuppressWarnings("deprecation")
151153
@Test
152154
public void testConsumeAndProduceTransactionHandleError() throws Exception {
153155
testConsumeAndProduceTransactionGuts(true, AckMode.RECORD, EOSMode.V1);
154156
}
155157

158+
@SuppressWarnings("deprecation")
156159
@Test
157160
public void testConsumeAndProduceTransactionKTMManual() throws Exception {
158161
testConsumeAndProduceTransactionGuts(false, AckMode.MANUAL_IMMEDIATE, EOSMode.V1);
159162
}
160163

164+
@SuppressWarnings("deprecation")
161165
@Test
162166
public void testConsumeAndProduceTransactionKTM_BETA() throws Exception {
163167
testConsumeAndProduceTransactionGuts(false, AckMode.RECORD, EOSMode.V1);

0 commit comments

Comments
 (0)