Skip to content
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

@RetryableTopic support KL annotated on class part 2 #3112

Merged
merged 3 commits into from
Mar 12, 2024

Conversation

Wzy19930507
Copy link
Contributor

  • EndpointCustomizerFactory adaptor MultiMethodKafkaListenerEndpoint.
  • RetryTopicConfigurer.processAndRegisterEndpoint support @KafkaListener on a class.
  • Add new class EndpointHandlerMultiMethod to handler multi method for retrying endpoints.

part2 of #3105 and this contributes to fixing #3105 eventually.

* `EndpointCustomizerFactory` adaptor `MultiMethodKafkaListenerEndpoint`.
* `RetryTopicConfigurer.processAndRegisterEndpoint` support `@KafkaListener` on a class.
* Add new class `EndpointHandlerMultiMethod` to handler multi method for retrying endpoints.

part2 of spring-projects#3105 and this contributes to fixing spring-projects#3105 eventually
public void setDefaultMethod(Method defaultMethod) {
this.defaultMethod = defaultMethod;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding new public methods in a public class. This deserves a brief mention in whats-new.


/**
* Customize the endpoint and return the topic names generated for this endpoint.
* @param listenerEndpoint The main, retry or DLT endpoint to be customized.
* @return A collection containing the topic names generated for this endpoint.
*/
Collection<TopicNamesHolder> customizeEndpointAndCollectTopics(MethodKafkaListenerEndpoint<?, ?> listenerEndpoint);
Collection<TopicNamesHolder> customizeEndpointAndCollectTopics(T listenerEndpoint);

class TopicNamesHolder {

Copy link
Contributor

@sobychacko sobychacko Mar 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifying the interface signature, which is part of the public API. Although we are just adding a strong type here and it may not affect any implementations, we may also need to mention this in whats-new. - the fact that EndpointCustomizer is strictly for MethodKafkaListenerEndpoint types.

}

protected EndpointCustomizer addSuffixesAndMethod(DestinationTopic.Properties properties, Object bean, Method method) {
protected EndpointCustomizer<MethodKafkaListenerEndpoint<?, ?>> addSuffixesAndMethod(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public API modified. It may theoretically break any external implementations (although very unlikely that some might be implementing this, we need to be mindful of that possibility. Why don't we deprecate the original and add the modification separately?

@@ -54,6 +54,12 @@ public EndpointHandlerMethod(Object beanOrClass, String methodName) {
this.methodName = methodName;
}

public EndpointHandlerMethod(Object bean) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new public constructor that needs to be mentioned in docs (or whats-new).

this.defaultMethod = defaultMethod;
}

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New public API class that needs to be mentioned in whats-new.

…ionTopic.Properties, Object, Method)`.

* Change public API that mentioned in `whats-new.adoc`(or javadoc).
@sobychacko sobychacko added this to the 3.2.0-M2 milestone Mar 12, 2024
@sobychacko sobychacko merged commit 4e9c099 into spring-projects:main Mar 12, 2024
3 checks passed
@Wzy19930507 Wzy19930507 deleted the GH-3012_part_2_pass branch March 13, 2024 09:48
sobychacko pushed a commit that referenced this pull request Mar 18, 2024
Fixes: #3012 

* Non-blocking retries support for `@KafkaListener` on class level, which includes `@RetryableTopic,` `@DltHandler,` `RetryTopicConfiguration,` and `RetryTopicConfigurationSupport.`
* Doc and test for Non-blocking retries support for @KafkaListener on class level.
* Addressing PR review. 

See these earlier related PRs:

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

Successfully merging this pull request may close these issues.

2 participants