Skip to content

Documentation update for setAckOnError method #2286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sergey-morenets opened this issue May 30, 2022 · 2 comments
Closed

Documentation update for setAckOnError method #2286

sergey-morenets opened this issue May 30, 2022 · 2 comments

Comments

@sergey-morenets
Copy link

sergey-morenets commented May 30, 2022

In what version(s) of Spring for Apache Kafka are you seeing this issue?

2.8.6 (latest)

Describe the bug

The current documentation for Spring Kafka references setAckOnError method that was probably removed earlier:

https://docs.spring.io/spring-kafka/docs/current/reference/html/#default-eh

@Bean
public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerContainerFactory() {
    ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory();
    factory.setConsumerFactory(consumerFactory());
    factory.getContainerProperties().setAckOnError(false);
    factory.getContainerProperties().setAckMode(AckMode.RECORD);
    factory.setCommonErrorHandler(new DefaultErrorHandler(new FixedBackOff(1000L, 2L)));
    return factory;
}

I couldn't find it in the latest source version:

https://github.com/spring-projects/spring-kafka/blob/main/spring-kafka/src/main/java/org/springframework/kafka/listener/ContainerProperties.java

Expected behavior

Usage of this method should be removed from the documentation.

@sergey-morenets
Copy link
Author

There's one more code block in the documentation that fails to compile:

DeadLetterPublishingRecoverer recoverer = new DeadLetterPublishingRecoverer(template,
        (r, e) -> {
            if (e instanceof FooException) {
                return new TopicPartition(r.topic() + ".Foo.failures", r.partition());
            }
            else {
                return new TopicPartition(r.topic() + ".other.failures", r.partition());
            }
        });
ErrorHandler errorHandler = new DefaultErrorHandler(recoverer, new FixedBackOff(0L, 2L));

It seems to me that ErrorHandler should be replaced with CommonErrorHandler here.

garyrussell added a commit that referenced this issue May 31, 2022
Resolves #2286

Remove `ackOnError` and fix error handler type.
garyrussell added a commit that referenced this issue May 31, 2022
Resolves #2286

Remove `ackOnError` and fix error handler type.
garyrussell added a commit that referenced this issue May 31, 2022
Resolves #2286

Remove `ackOnError` and fix error handler type.
@garyrussell
Copy link
Contributor

Thanks! Back-ported to affected branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants