Skip to content

Commit

Permalink
Add Properties to Deprecation Annotations
Browse files Browse the repository at this point in the history
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
  • Loading branch information
garyrussell authored and artembilan committed Sep 21, 2022
1 parent 0da801f commit 9066598
Show file tree
Hide file tree
Showing 26 changed files with 28 additions and 301 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void setReplyTemplate(KafkaTemplate<?, ?> replyTemplate) {
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
* @see #setCommonErrorHandler(CommonErrorHandler)
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public void setErrorHandler(org.springframework.kafka.listener.ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
Expand All @@ -225,7 +225,7 @@ public void setErrorHandler(org.springframework.kafka.listener.ErrorHandler erro
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
* @see #setCommonErrorHandler(CommonErrorHandler)
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public void setBatchErrorHandler(org.springframework.kafka.listener.BatchErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ public boolean isProducerPerThread() {
* {@code org.springframework.kafka.listener.ContainerProperties.EOSMode#V1} is no
* longer supported.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
public void setProducerPerConsumerPartition(boolean producerPerConsumerPartition) {
}

Expand All @@ -452,7 +452,7 @@ public void setProducerPerConsumerPartition(boolean producerPerConsumerPartition
* {@code org.springframework.kafka.listener.ContainerProperties.EOSMode#V1} is no
* longer supported.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
@Override
public boolean isProducerPerConsumerPartition() {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @since 2.9
* @deprecated no longer needed; use {@code KafkaOperations}.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
public interface KafkaOperations2<K, V> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ default boolean transactionCapable() {
* @since 1.3.8
* @deprecated - no longer needed.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
default void closeProducerFor(String transactionIdSuffix) {
}

Expand All @@ -96,7 +96,7 @@ default void closeProducerFor(String transactionIdSuffix) {
* {@code org.springframework.kafka.listener.ContainerProperties.EOSMode#V1} is no
* longer supported.
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
default boolean isProducerPerConsumerPartition() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public ApplicationEventPublisher getApplicationEventPublisher() {
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
* @see #setCommonErrorHandler(CommonErrorHandler)
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public void setErrorHandler(ErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
Expand All @@ -226,7 +226,7 @@ public void setErrorHandler(ErrorHandler errorHandler) {
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
* @see #setCommonErrorHandler(CommonErrorHandler)
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public void setGenericErrorHandler(@Nullable GenericErrorHandler<?> errorHandler) {
this.errorHandler = errorHandler;
}
Expand All @@ -238,7 +238,7 @@ public void setGenericErrorHandler(@Nullable GenericErrorHandler<?> errorHandler
* @deprecated in favor of {@link #setCommonErrorHandler(CommonErrorHandler)}
* @see #setCommonErrorHandler(CommonErrorHandler)
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public void setBatchErrorHandler(BatchErrorHandler errorHandler) {
this.errorHandler = errorHandler;
}
Expand All @@ -250,7 +250,7 @@ public void setBatchErrorHandler(BatchErrorHandler errorHandler) {
* @deprecated in favor of {@link #getCommonErrorHandler()}
* @see #getCommonErrorHandler()
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@Nullable
public GenericErrorHandler<?> getGenericErrorHandler() {
return this.errorHandler;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
* @since 1.1
* @deprecated in favor of {@link CommonErrorHandler}.
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public interface BatchErrorHandler extends GenericErrorHandler<ConsumerRecords<?, ?>> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void setStopContainerAbnormally(boolean stopContainerAbnormally) {
}

@Override
@Deprecated
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
public boolean remainingRecords() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public interface CommonErrorHandler extends DeliveryAttemptAware {
* @see #handleRecord(Exception, ConsumerRecord, Consumer, MessageListenerContainer)
* @see #handleRemaining(Exception, List, Consumer, MessageListenerContainer)
*/
@Deprecated
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
default boolean remainingRecords() {
return false;
}
Expand Down Expand Up @@ -97,7 +97,7 @@ default void handleOtherException(Exception thrownException, Consumer<?, ?> cons
* {@link #handleOne(Exception, ConsumerRecord, Consumer, MessageListenerContainer)}.
* @see #remainingRecords()
*/
@Deprecated
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
default void handleRecord(Exception thrownException, ConsumerRecord<?, ?> record, Consumer<?, ?> consumer,
MessageListenerContainer container) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void setAckAfterHandle(boolean ackAfterHandle) {
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @deprecated in favor of {@link CommonErrorHandler}.
*
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface ConsumerAwareBatchErrorHandler extends BatchErrorHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* @deprecated in favor of {@link CommonErrorHandler}.
*
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface ConsumerAwareErrorHandler extends ErrorHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @deprecated - use {@link RecordInterceptor}.
*
*/
@Deprecated
@Deprecated(since = "3.0", forRemoval = true) // in 3.1
@FunctionalInterface
public interface ConsumerAwareRecordInterceptor<K, V> extends RecordInterceptor<K, V> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @since 2.1
* @deprecated in favor of {@link CommonErrorHandler}.
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface ContainerAwareBatchErrorHandler extends ConsumerAwareBatchErrorHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @deprecated in favor of {@link CommonErrorHandler}.
*
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface ContainerAwareErrorHandler extends RemainingRecordsErrorHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void setAckAfterHandle(boolean ackAfterHandle) {
}

@Override
@Deprecated
@Deprecated(since = "2.9", forRemoval = true) // in 3.1
public boolean remainingRecords() {
return isSeekAfterError();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @author Gary Russell
* @deprecated in favor of {@link CommonErrorHandler}.
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
public interface ErrorHandler extends GenericErrorHandler<ConsumerRecord<?, ?>> {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,30 +159,6 @@ private void add(boolean classified, Class<? extends Exception>... exceptionType
}
}

/**
* Remove an exception type from the configured list. By default, the following
* exceptions will not be retried:
* <ul>
* <li>{@link DeserializationException}</li>
* <li>{@link MessageConversionException}</li>
* <li>{@link ConversionException}</li>
* <li>{@link MethodArgumentResolutionException}</li>
* <li>{@link NoSuchMethodException}</li>
* <li>{@link ClassCastException}</li>
* </ul>
* All others will be retried, unless {@link #defaultFalse()} has been called.
* @param exceptionType the exception type.
* @return true if the removal was successful.
* @deprecated in favor of {@link #removeClassification(Class)}
* @see #addNotRetryableExceptions(Class...)
* @see #setClassifications(Map, boolean)
* @see #defaultFalse()
*/
@Deprecated
public boolean removeNotRetryableException(Class<? extends Exception> exceptionType) {
return Boolean.TRUE.equals(removeClassification(exceptionType)) ? true : false;
}

/**
* Remove an exception type from the configured list. By default, the following
* exceptions will not be retried:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.function.BiFunction;

import org.apache.commons.logging.LogFactory;
import org.apache.kafka.clients.consumer.Consumer;
import org.apache.kafka.clients.consumer.ConsumerRecord;

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

/**
* Return a {@link RecoveryStrategy} to call to determine whether the first record in the
* list should be skipped.
* @param records the records.
* @param thrownException the exception.
* @return the {@link RecoveryStrategy}.
* @since 2.7
* @deprecated - no longer used.
*/
@Deprecated
protected RecoveryStrategy getRecoveryStrategy(List<ConsumerRecord<?, ?>> records, Exception thrownException) {
return getRecoveryStrategy(records, null, thrownException);
}

/**
* Return a {@link RecoveryStrategy} to call to determine whether the first record in the
* list should be skipped.
* @param records the records.
* @param recoveryConsumer the consumer.
* @param thrownException the exception.
* @return the {@link RecoveryStrategy}.
* @since 2.8.4
* @deprecated - no longer used.
*/
@Deprecated
protected RecoveryStrategy getRecoveryStrategy(List<ConsumerRecord<?, ?>> records,
@Nullable Consumer<?, ?> recoveryConsumer, Exception thrownException) {

return this.failureTracker::recovered;
}

/**
* Return the failed record tracker.
* @return the tracker.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* @deprecated in favor of {@link CommonErrorHandler}.
*
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface GenericErrorHandler<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* @deprecated in favor of {@link CommonErrorHandler}.
*
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface ListenerInvokingBatchErrorHandler extends ContainerAwareBatchErrorHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* @deprecated in favor of {@link CommonErrorHandler}.
*
*/
@Deprecated
@Deprecated(since = "2.8", forRemoval = true) // in 3.1
@FunctionalInterface
public interface RemainingRecordsErrorHandler extends ConsumerAwareErrorHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package org.springframework.kafka.listener;

import java.time.Clock;
import java.time.Instant;

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

private final long timestamp;

@Deprecated
public TimestampedException(Exception ex, Clock clock) {
super(ex.getMessage(), ex);
this.timestamp = Instant.now(clock).toEpochMilli();
}

/**
* Constructs an instance with the provided cause
* and the current time.
Expand Down
Loading

0 comments on commit 9066598

Please sign in to comment.