Skip to content

Commit 9066598

Browse files
garyrussellartembilan
authored andcommitted
Add Properties to Deprecation Annotations
Indicate since and removal. Also - remove deprecations from 2.8 (except those related to error handlers) - remove `RetryingMessageListenerAdapter` which was temporarily reinstated for SIK - remove `TransactionSupport` - no longer used anywhere
1 parent 0da801f commit 9066598

26 files changed

+28
-301
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public void setReplyTemplate(KafkaTemplate<?, ?> replyTemplate) {
213213
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
214214
* @see #setCommonErrorHandler(CommonErrorHandler)
215215
*/
216-
@Deprecated
216+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
217217
public void setErrorHandler(org.springframework.kafka.listener.ErrorHandler errorHandler) {
218218
this.errorHandler = errorHandler;
219219
}
@@ -225,7 +225,7 @@ public void setErrorHandler(org.springframework.kafka.listener.ErrorHandler erro
225225
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
226226
* @see #setCommonErrorHandler(CommonErrorHandler)
227227
*/
228-
@Deprecated
228+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
229229
public void setBatchErrorHandler(org.springframework.kafka.listener.BatchErrorHandler errorHandler) {
230230
this.errorHandler = errorHandler;
231231
}

spring-kafka/src/main/java/org/springframework/kafka/core/DefaultKafkaProducerFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ public boolean isProducerPerThread() {
440440
* {@code org.springframework.kafka.listener.ContainerProperties.EOSMode#V1} is no
441441
* longer supported.
442442
*/
443-
@Deprecated
443+
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
444444
public void setProducerPerConsumerPartition(boolean producerPerConsumerPartition) {
445445
}
446446

@@ -452,7 +452,7 @@ public void setProducerPerConsumerPartition(boolean producerPerConsumerPartition
452452
* {@code org.springframework.kafka.listener.ContainerProperties.EOSMode#V1} is no
453453
* longer supported.
454454
*/
455-
@Deprecated
455+
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
456456
@Override
457457
public boolean isProducerPerConsumerPartition() {
458458
return false;

spring-kafka/src/main/java/org/springframework/kafka/core/KafkaOperations2.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
* @since 2.9
5151
* @deprecated no longer needed; use {@code KafkaOperations}.
5252
*/
53-
@Deprecated
53+
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
5454
public interface KafkaOperations2<K, V> {
5555

5656
/**

spring-kafka/src/main/java/org/springframework/kafka/core/ProducerFactory.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ default boolean transactionCapable() {
8484
* @since 1.3.8
8585
* @deprecated - no longer needed.
8686
*/
87-
@Deprecated
87+
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
8888
default void closeProducerFor(String transactionIdSuffix) {
8989
}
9090

@@ -96,7 +96,7 @@ default void closeProducerFor(String transactionIdSuffix) {
9696
* {@code org.springframework.kafka.listener.ContainerProperties.EOSMode#V1} is no
9797
* longer supported.
9898
*/
99-
@Deprecated
99+
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
100100
default boolean isProducerPerConsumerPartition() {
101101
return false;
102102
}

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

+4-4
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public ApplicationEventPublisher getApplicationEventPublisher() {
214214
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
215215
* @see #setCommonErrorHandler(CommonErrorHandler)
216216
*/
217-
@Deprecated
217+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
218218
public void setErrorHandler(ErrorHandler errorHandler) {
219219
this.errorHandler = errorHandler;
220220
}
@@ -226,7 +226,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
226226
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
227227
* @see #setCommonErrorHandler(CommonErrorHandler)
228228
*/
229-
@Deprecated
229+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
230230
public void setGenericErrorHandler(@Nullable GenericErrorHandler<?> errorHandler) {
231231
this.errorHandler = errorHandler;
232232
}
@@ -238,7 +238,7 @@ public void setGenericErrorHandler(@Nullable GenericErrorHandler<?> errorHandler
238238
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
239239
* @see #setCommonErrorHandler(CommonErrorHandler)
240240
*/
241-
@Deprecated
241+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
242242
public void setBatchErrorHandler(BatchErrorHandler errorHandler) {
243243
this.errorHandler = errorHandler;
244244
}
@@ -250,7 +250,7 @@ public void setBatchErrorHandler(BatchErrorHandler errorHandler) {
250250
* @deprecated in favor of {@link #getCommonErrorHandler()}
251251
* @see #getCommonErrorHandler()
252252
*/
253-
@Deprecated
253+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
254254
@Nullable
255255
public GenericErrorHandler<?> getGenericErrorHandler() {
256256
return this.errorHandler;

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
* @since 1.1
3232
* @deprecated in favor of {@link CommonErrorHandler}.
3333
*/
34-
@Deprecated
34+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3535
public interface BatchErrorHandler extends GenericErrorHandler<ConsumerRecords<?, ?>> {
3636

3737
/**

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void setStopContainerAbnormally(boolean stopContainerAbnormally) {
7171
}
7272

7373
@Override
74-
@Deprecated
74+
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
7575
public boolean remainingRecords() {
7676
return true;
7777
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public interface CommonErrorHandler extends DeliveryAttemptAware {
4747
* @see #handleRecord(Exception, ConsumerRecord, Consumer, MessageListenerContainer)
4848
* @see #handleRemaining(Exception, List, Consumer, MessageListenerContainer)
4949
*/
50-
@Deprecated
50+
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
5151
default boolean remainingRecords() {
5252
return false;
5353
}
@@ -97,7 +97,7 @@ default void handleOtherException(Exception thrownException, Consumer<?, ?> cons
9797
* {@link #handleOne(Exception, ConsumerRecord, Consumer, MessageListenerContainer)}.
9898
* @see #remainingRecords()
9999
*/
100-
@Deprecated
100+
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
101101
default void handleRecord(Exception thrownException, ConsumerRecord<?, ?> record, Consumer<?, ?> consumer,
102102
MessageListenerContainer container) {
103103

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void setAckAfterHandle(boolean ackAfterHandle) {
4848
}
4949

5050
@Override
51-
@Deprecated
51+
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
5252
public void handleRecord(Exception thrownException, ConsumerRecord<?, ?> record, Consumer<?, ?> consumer,
5353
MessageListenerContainer container) {
5454

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @deprecated in favor of {@link CommonErrorHandler}.
3131
*
3232
*/
33-
@Deprecated
33+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3434
@FunctionalInterface
3535
public interface ConsumerAwareBatchErrorHandler extends BatchErrorHandler {
3636

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
* @deprecated in favor of {@link CommonErrorHandler}.
3333
*
3434
*/
35-
@Deprecated
35+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3636
@FunctionalInterface
3737
public interface ConsumerAwareErrorHandler extends ErrorHandler {
3838

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @deprecated - use {@link RecordInterceptor}.
3030
*
3131
*/
32-
@Deprecated
32+
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
3333
@FunctionalInterface
3434
public interface ConsumerAwareRecordInterceptor<K, V> extends RecordInterceptor<K, V> {
3535

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @since 2.1
3030
* @deprecated in favor of {@link CommonErrorHandler}.
3131
*/
32-
@Deprecated
32+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3333
@FunctionalInterface
3434
public interface ContainerAwareBatchErrorHandler extends ConsumerAwareBatchErrorHandler {
3535

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @deprecated in favor of {@link CommonErrorHandler}.
3535
*
3636
*/
37-
@Deprecated
37+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3838
@FunctionalInterface
3939
public interface ContainerAwareErrorHandler extends RemainingRecordsErrorHandler {
4040

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public void setAckAfterHandle(boolean ackAfterHandle) {
134134
}
135135

136136
@Override
137-
@Deprecated
137+
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
138138
public boolean remainingRecords() {
139139
return isSeekAfterError();
140140
}

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
* @author Gary Russell
2929
* @deprecated in favor of {@link CommonErrorHandler}.
3030
*/
31-
@Deprecated
31+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3232
public interface ErrorHandler extends GenericErrorHandler<ConsumerRecord<?, ?>> {
3333

3434
/**

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

-24
Original file line numberDiff line numberDiff line change
@@ -159,30 +159,6 @@ private void add(boolean classified, Class<? extends Exception>... exceptionType
159159
}
160160
}
161161

162-
/**
163-
* Remove an exception type from the configured list. By default, the following
164-
* exceptions will not be retried:
165-
* <ul>
166-
* <li>{@link DeserializationException}</li>
167-
* <li>{@link MessageConversionException}</li>
168-
* <li>{@link ConversionException}</li>
169-
* <li>{@link MethodArgumentResolutionException}</li>
170-
* <li>{@link NoSuchMethodException}</li>
171-
* <li>{@link ClassCastException}</li>
172-
* </ul>
173-
* All others will be retried, unless {@link #defaultFalse()} has been called.
174-
* @param exceptionType the exception type.
175-
* @return true if the removal was successful.
176-
* @deprecated in favor of {@link #removeClassification(Class)}
177-
* @see #addNotRetryableExceptions(Class...)
178-
* @see #setClassifications(Map, boolean)
179-
* @see #defaultFalse()
180-
*/
181-
@Deprecated
182-
public boolean removeNotRetryableException(Class<? extends Exception> exceptionType) {
183-
return Boolean.TRUE.equals(removeClassification(exceptionType)) ? true : false;
184-
}
185-
186162
/**
187163
* Remove an exception type from the configured list. By default, the following
188164
* exceptions will not be retried:

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

-32
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.function.BiFunction;
2424

2525
import org.apache.commons.logging.LogFactory;
26-
import org.apache.kafka.clients.consumer.Consumer;
2726
import org.apache.kafka.clients.consumer.ConsumerRecord;
2827

2928
import org.springframework.core.log.LogAccessor;
@@ -172,37 +171,6 @@ public int deliveryAttempt(TopicPartitionOffset topicPartitionOffset) {
172171
return this.failureTracker.deliveryAttempt(topicPartitionOffset);
173172
}
174173

175-
/**
176-
* Return a {@link RecoveryStrategy} to call to determine whether the first record in the
177-
* list should be skipped.
178-
* @param records the records.
179-
* @param thrownException the exception.
180-
* @return the {@link RecoveryStrategy}.
181-
* @since 2.7
182-
* @deprecated - no longer used.
183-
*/
184-
@Deprecated
185-
protected RecoveryStrategy getRecoveryStrategy(List<ConsumerRecord<?, ?>> records, Exception thrownException) {
186-
return getRecoveryStrategy(records, null, thrownException);
187-
}
188-
189-
/**
190-
* Return a {@link RecoveryStrategy} to call to determine whether the first record in the
191-
* list should be skipped.
192-
* @param records the records.
193-
* @param recoveryConsumer the consumer.
194-
* @param thrownException the exception.
195-
* @return the {@link RecoveryStrategy}.
196-
* @since 2.8.4
197-
* @deprecated - no longer used.
198-
*/
199-
@Deprecated
200-
protected RecoveryStrategy getRecoveryStrategy(List<ConsumerRecord<?, ?>> records,
201-
@Nullable Consumer<?, ?> recoveryConsumer, Exception thrownException) {
202-
203-
return this.failureTracker::recovered;
204-
}
205-
206174
/**
207175
* Return the failed record tracker.
208176
* @return the tracker.

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* @deprecated in favor of {@link CommonErrorHandler}.
3131
*
3232
*/
33-
@Deprecated
33+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3434
@FunctionalInterface
3535
public interface GenericErrorHandler<T> {
3636

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @deprecated in favor of {@link CommonErrorHandler}.
3030
*
3131
*/
32-
@Deprecated
32+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3333
@FunctionalInterface
3434
public interface ListenerInvokingBatchErrorHandler extends ContainerAwareBatchErrorHandler {
3535

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @deprecated in favor of {@link CommonErrorHandler}.
3535
*
3636
*/
37-
@Deprecated
37+
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
3838
@FunctionalInterface
3939
public interface RemainingRecordsErrorHandler extends ConsumerAwareErrorHandler {
4040

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

-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
package org.springframework.kafka.listener;
1818

19-
import java.time.Clock;
2019
import java.time.Instant;
2120

2221
import org.springframework.kafka.KafkaException;
@@ -34,12 +33,6 @@ public class TimestampedException extends KafkaException {
3433

3534
private final long timestamp;
3635

37-
@Deprecated
38-
public TimestampedException(Exception ex, Clock clock) {
39-
super(ex.getMessage(), ex);
40-
this.timestamp = Instant.now(clock).toEpochMilli();
41-
}
42-
4336
/**
4437
* Constructs an instance with the provided cause
4538
* and the current time.

0 commit comments

Comments
 (0)